Skip to content

Commit

Permalink
Use best_match to provide a more useful error message
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaulik committed Feb 19, 2025
1 parent e4eeb13 commit 3efaa57
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stac_validator/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import click # type: ignore
import jsonschema # type: ignore
from jsonschema.exceptions import best_match
from requests import exceptions # type: ignore

from .utilities import (
Expand Down Expand Up @@ -253,6 +254,7 @@ def extensions_validator(self, stac_type: str) -> Dict:
message["schema"].append(extension)

except jsonschema.exceptions.ValidationError as e:
e = best_match(e.context)
valid = False
if e.absolute_path:
err_msg = (
Expand Down

0 comments on commit 3efaa57

Please sign in to comment.