jsonschema_extras package¶
Utilities for working with the JSON Schema Python library jsonschema.
Features:
- jsonschema_extras.BUNDLED_SCHEMAS_URI_BASE: Final[str] = 'file:/jsonschema_extras/schemas'¶
Base URI for schemas bundled with this library.
See also
- jsonschema_extras.bundled_schemas_files()[source]¶
Returns a
Traversableobject containing resources for bundled schemas.Built upon
importlib.resources.files().- Return type:
- jsonschema_extras.bundled_schemas_retriever(*, open_buffering=-1, cache=None)[source]¶
Context manager producing a retrieval callable for this library’s bundled schemas.
Warning
The produced retriever is only valid within duration of an explicit lifecycle, hence the context manager.
- Parameters:
cache (
GenericAlias[Any] |Literal['default'] |None) – Caching decorator forRetrieve, or'default'to use the default caching implementation (see description ofjsonschema_extras.registries.retrievalfor details). Defaults toNone, meaning no caching.open_buffering (
int) – Optional integer used to set the buffering policy. See the Python built-in functionopen().
- Yields:
A retrieval callable for this library’s bundled schemas. The retriever is only valid until the context is exited.
- Raises:
ValueError – On invalid uri_base.
- Return type:
Note
The implementation uses
importlib.resourceswhich conceptually cannot provide a persistent path to a directory which could be accessed by common code at any time. The lifecycle has to be explicit due to using package resources.
Subpackages¶
- jsonschema_extras.formats package
- jsonschema_extras.registries package
CacheFnCacheSpecDefaultLOADS_FN_JSON_DEFAULT()LoadTextFnNoSuchResourceFromValueErrorRESOURCE_FROM_CONTENTS_FN_DEFAULT()ResourceFromContentsFnRetrievalURITranslatorRetrieveTextFnRetrieversChainbuild_schemas_from_filesystem_retriever()file_path_from_uri_by_base()retrieve_text_from_filesystem()schema_data_from_json_text()to_cached_resource()to_maybe_cached_resource()to_resource()- Subpackages
- Submodules