pystac.validation¶
- 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) List[Any] [source]¶
Validates a
STACObject
.- Parameters:
stac_object – The stac object to validate.
- 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[Object]
- Raises:
- pystac.validation.validate_all(stac_dict: Dict[str, Any], href: str, stac_io: Optional[StacIO] = None) None [source]¶
Validate STAC JSON and all contained catalogs, collections and items.
If this stac_dict represents a catalog or collection, this method will recursively be called 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 – This will raise a STACValidationError if this or any contained catalog, collection or item has a validation error.
- pystac.validation.validate_dict(stac_dict: Dict[str, Any], stac_object_type: Optional[STACObjectType] = None, stac_version: Optional[str] = None, extensions: Optional[List[str]] = None, href: Optional[str] = None) List[Any] [source]¶
Validate a stac object serialized as JSON into a dict.
This method delegates to the call to
pystac.validation.STACValidator.validate()
for the STACValidator registered viaset_validator()
orJsonSchemaSTACValidator
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.
- 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[Object]
- Raises: