A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pystac.readthedocs.io/en/latest/api/validation.html below:

pystac.validation — pystac 1.13.0 documentation

pystac.validation#
exception pystac.validation.GetSchemaError(href: str, error: Exception)[source]#

Raised when unable to fetch a schema.

class pystac.validation.JsonSchemaSTACValidator(schema_uri_map: SchemaUriMap | None = None)[source]#

Validate STAC based on JSON Schemas.

This validator uses JSON schemas, read from URIs provided by a SchemaUriMap, to validate STAC core objects and extensions.

Parameters:

schema_uri_map – The SchemaUriMap that defines where the validator will retrieve the JSON schemas for validation. Defaults to an instance of DefaultSchemaUriMap

Note: This class requires the jsonschema library to be installed.

get_schema_from_uri(schema_uri: str) tuple[dict[str, Any], Any][source]#

DEPRECATED

property registry: Any#
schema_cache: dict[str, dict[str, Any]]#
schema_uri_map: SchemaUriMap#
validate_core(stac_dict: dict[str, Any], stac_object_type: STACObjectType, stac_version: str, href: str | None = None) str | None[source]#

Validate a core stac object.

Return value can be None or specific to the implementation.

Parameters:
  • stac_dict – Dictionary that is the STAC json of the object.

  • stac_object_type – The stac object type of the object encoded in stac_dict. One of STACObjectType.

  • stac_version – The version of STAC to validate the object against.

  • href – Optional HREF of the STAC object being validated.

Returns:
URI for the JSON schema that was validated against, or None if

no validation occurred.

Return type:

str

Raises:

STACValidationError – if stac_dict is not valid. The exception is raised from the “best” error, as determined by the jsonschema library. To access all jsonschema validation errors, use STACValidationError.source.

validate_extension(stac_dict: dict[str, Any], stac_object_type: STACObjectType, stac_version: str, extension_id: str, href: str | None = None) str | None[source]#

Validate an extension stac object.

Return value can be None or specific to the implementation.

Parameters:
  • stac_dict – Dictionary that is the STAC json of the object.

  • stac_object_type – The stac object type of the object encoded in stac_dict. One of STACObjectType.

  • stac_version – The version of STAC to validate the object against.

  • extension_id – The extension ID to validate against.

  • href – Optional HREF of the STAC object being validated.

Returns:
URI for the JSON schema that was validated against, or None if

no validation occurred.

Return type:

str

Raises:

STACValidationError – if stac_dict is not valid. The exception is raised from the “best” error, as determined by the jsonschema library. To access all jsonschema validation errors, use STACValidationError.source.

class pystac.validation.RegisteredValidator[source]#
classmethod get_validator() STACValidator[source]#
classmethod set_validator(validator: STACValidator) None[source]#
pystac.validation.set_validator(validator: STACValidator) None[source]#

Sets the STACValidator to use in PySTAC.

Parameters:

validator – The STACValidator implementation to use for validation.

pystac.validation.validate(stac_object: STACObject, validator: STACValidator | None = None) list[Any][source]#

Validates a STACObject.

Parameters:
  • stac_object – The stac object to validate.

  • validator – A custom validator to use for validation of the STAC object. If omitted, the default validator from RegisteredValidator will be used instead.

Returns:
List of return values from the validation calls for the

core object and any extensions. Element type is specific to the STACValidator implementation.

Return type:

List[Any]

Raises:

STACValidationError

pystac.validation.validate_all(stac_object: STACObject | dict[str, Any], href: str | None = None, stac_io: pystac.StacIO | None = None) None[source]#

Validate a STACObject, or a STAC object serialized as JSON into a dict.

If the STAC object represents a catalog or collection, this function will be called recursively for each child link and all contained items.

Parameters:
  • stac_object – STAC object to validate

  • href – HREF of the STAC object being validated. Used for error reporting and resolving relative links.

  • stac_io – Optional StacIO instance to use for reading hrefs. If None, the StacIO.default() instance is used.

Raises:

STACValidationError or ValueError – STACValidationError is raised if the STAC object or any contained catalog, collection, or item has a validation error. ValueError is raised if stac_object is a STACObject and href is not None, or if stac_object is a dict and href is None.

pystac.validation.validate_all_dict(stac_dict: dict[str, Any], href: str | None, stac_io: StacIO | None = None) None[source]#

Validate a stac object serialized as JSON into a dict.

If the STAC object represents a catalog or collection, this function will be called recursively for each child link and all contained items.

Parameters:
  • stac_dict – Dictionary that is the STAC json of the object.

  • href – HREF of the STAC object being validated. Used for error reporting and resolving relative links.

  • stac_io – Optional StacIO instance to use for reading hrefs. If None, the StacIO.default() instance is used.

Raises:

STACValidationError – if the STAC object or any contained catalog, collection, or item has a validation error

pystac.validation.validate_dict(stac_dict: dict[str, Any], stac_object_type: STACObjectType | None = None, stac_version: str | None = None, extensions: list[str] | None = None, href: str | None = None, validator: STACValidator | None = None) list[Any][source]#

Validate a stac object serialized as JSON into a dict.

This method delegates to the call to validate() for the STACValidator registered via set_validator() or JsonSchemaSTACValidator by default.

Parameters:
  • stac_dict – Dictionary that is the STAC json of the object.

  • stac_object_type – The stac object type of the object encoded in stac_dict. One of STACObjectType. If not supplied, this will use PySTAC’s identification logic to identify the object type.

  • stac_version – The version of STAC to validate the object against. If not supplied, this will use PySTAC’s identification logic to identify the stac version

  • extensions – Extension IDs for this stac object. If not supplied, PySTAC’s identification logic to identify the extensions.

  • href – Optional HREF of the STAC object being validated.

  • validator – A custom validator to use for validation of the STAC dictionary. If omitted, the default validator from RegisteredValidator will be used instead.

Returns:
List of return values from the validation calls for the

core object and any extensions. Element type is specific to the STACValidator implementation.

Return type:

List[Any]

Raises:

STACValidationError


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4