Loader
openapi_first.loader
Summary
OpenAPI specification loading and validation utilities.
This module is responsible for loading an OpenAPI 3.x specification from disk and validating it before it is used by the application.
It enforces the principle that an invalid or malformed OpenAPI document must never reach the routing or runtime layers.
Notes
Design Principles:
1 2 3 4 | |
Constraints:
1 2 3 4 5 | |
Classes
OpenAPISpecLoadError
Bases: OpenAPIFirstError
Raised when an OpenAPI specification cannot be loaded or validated.
Notes
Guarantees:
1 2 | |
Functions
load_openapi
Load and validate an OpenAPI 3.x specification from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
str | Path
|
Filesystem path to an OpenAPI specification file. Supported
extensions: |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
dict[str, Any]: Parsed and validated OpenAPI specification. |
Raises:
| Type | Description |
|---|---|
OpenAPISpecLoadError
|
If the file does not exist, cannot be parsed, or fails OpenAPI schema validation. |
Notes
Guarantees:
1 2 3 4 | |