httk.serve.http.openapi.resources

Load packaged OpenAPI contracts and bundled JSON Schema documents offline.

Functions

load_packaged_contract(package, *path)

Load an OpenAPI contract from package data without network access.

packaged_schema_documents(package, *path)

Load every bundled JSON Schema document below a package resource.

packaged_schema_registry(package, *path)

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: .yaml and .yml through yaml.safe_load, .json through json.loads(). Both formats yield the same mapping shape that httk.serve.http.openapi.create_openapi_app() consumes.

Parameters:
  • package (str) – Importable package that ships the contract as package data.

  • *path (str) – Path segments joined below the package to reach the resource.

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:

dict[str, Any]

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 *.json file is parsed, and those that decode to a mapping carrying a $schema key are returned unchanged.

Parameters:
  • package (str) – Importable package that ships the schema documents.

  • *path (str) – Path segments joined below the package to reach the schema root.

Returns:

Parsed JSON Schema documents in stable order.

Return type:

tuple[dict[str, Any], Ellipsis]

httk.serve.http.openapi.resources.packaged_schema_registry(package, *path)[source]

Build an offline schema registry from bundled JSON Schema documents.

Parameters:
  • package (str) – Importable package that ships the schema documents.

  • *path (str) – Path segments joined below the package to reach the schema root.

Returns:

Registry over the bundled documents.

Raises:

httk.serve.http.openapi.OpenAPISchemaError – If any document is invalid.

Return type:

httk.serve.http.openapi.schemas.OpenAPISchemaRegistry