Skip to content

Add more info to validation errors #1233

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 28, 2023
Merged

Conversation

gadomski
Copy link
Member

@gadomski gadomski commented Sep 27, 2023

Related Issue(s):

Description:

Before, when validating an item that has a collection field but no link with rel="collection":

pystac.errors.STACValidationError: Validation failed for Feature with ID test-item against schema at https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json

After:

pystac.errors.STACValidationError: Validation failed for Feature with ID test-item against schema at https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json
"can't have a collection" should not be valid under {}

Failed validating 'not' in schema['allOf'][0]['allOf'][2]['else']['properties']['collection']:
    {'not': {}}

On instance['collection']:
    "can't have a collection"

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run scripts/test)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage.
  • Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

@gadomski gadomski requested a review from jsignell September 27, 2023 14:52
@gadomski gadomski self-assigned this Sep 27, 2023
@gadomski gadomski force-pushed the issues/901-jsonschema-errors branch from 2aee137 to 91c356e Compare September 27, 2023 14:53
@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Files Coverage Δ
pystac/validation/stac_validator.py 78.00% <50.00%> (-0.58%) ⬇️

📢 Thoughts on this report? Let us know!.

@gadomski gadomski force-pushed the issues/901-jsonschema-errors branch from 91c356e to b49957e Compare September 28, 2023 14:33
Copy link
Member

@jsignell jsignell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

@gadomski gadomski added this pull request to the merge queue Sep 28, 2023
Merged via the queue into main with commit fc839fb Sep 28, 2023
@gadomski gadomski deleted the issues/901-jsonschema-errors branch September 28, 2023 15:48
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Propagate error message from jsonschema to STACValidationError
2 participants