Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include some json schemas within pystac #1165

Merged
merged 7 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- `max_items` and `recursive` to `Catalog.validate_all` ([#1141](https://github.com/stac-utils/pystac/pull/1141))
- `KML` as a built in media type ([#1127](https://github.com/stac-utils/pystac/issues/1127))
- `move/copy/delete` operations for local Assets ([#1158](https://github.com/stac-utils/pystac/issues/1158))
- Latest core STAC spec jsonshemas are included in pytstac and used for validation ([#1165](https://github.com/stac-utils/pystac/pull/1165))

### Changed

Expand Down
10 changes: 7 additions & 3 deletions docs/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,13 @@ You can validate any :class:`~pystac.Catalog`, :class:`~pystac.Collection` or

item.validate()

This will validate against the latest set of JSON schemas hosted at
https://schemas.stacspec.org, including any extensions that the object extends. If there
are validation errors, a :class:`~pystac.validation.STACValidationError` will be raised.
This validates against the latest set of JSON schemas (which are included with the
PySTAC package) or older versions (which are hosted at https://schemas.stacspec.org).
This validation includes any extensions that the object extends (these are always
accessed remotely based on their URIs).

If there are validation errors, a :class:`~pystac.validation.STACValidationError`
is raised.

You can also call :meth:`~pystac.Catalog.validate_all` on a Catalog or Collection to
recursively walk through a catalog and validate all objects within it.
Expand Down
4 changes: 4 additions & 0 deletions pystac/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def __init__(
super().__init__(msg)


class STACLocalValidationError(Exception):
"""Schema not available locally"""


class STACValidationError(Exception):
"""Represents a validation error. Thrown by validation calls if the STAC JSON
is invalid.
Expand Down
Empty file.
Loading