httk.serve.http.openapi.resources¶
Load packaged OpenAPI contracts and bundled JSON Schema documents offline.
Functions¶
|
Load an OpenAPI contract from package data without network access. |
|
Load every bundled JSON Schema document below a package resource. |
|
Build an offline schema registry from bundled JSON Schema documents. |
Module Contents¶
- httk.serve.http.openapi.resources.load_packaged_contract(package, *path)[source]¶
Load an OpenAPI contract from package data without network access.
The resource is read as UTF-8 and parsed according to its suffix:
.yamland.ymlthroughyaml.safe_load,.jsonthroughjson.loads(). Both formats yield the same mapping shape thathttk.serve.http.openapi.create_openapi_app()consumes.- Parameters:
- Returns:
Parsed contract mapping.
- Raises:
ValueError – If the resource suffix is not a supported contract format.
RuntimeError – If the parsed contract is not a JSON object.
- Return type:
- httk.serve.http.openapi.resources.packaged_schema_documents(package, *path)[source]¶
Load every bundled JSON Schema document below a package resource.
The resource tree is walked in stable sorted order; every
*.jsonfile is parsed, and those that decode to a mapping carrying a$schemakey are returned unchanged.
- httk.serve.http.openapi.resources.packaged_schema_registry(package, *path)[source]¶
Build an offline schema registry from bundled JSON Schema documents.
- Parameters:
- Returns:
Registry over the bundled documents.
- Raises:
httk.serve.http.openapi.OpenAPISchemaError – If any document is invalid.
- Return type: