Skip to content
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
11 changes: 9 additions & 2 deletions stac_validator/stac_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def __init__(
level=numeric_log_level,
)
logging.info("STAC Validator Started.")
self.stac_version = version
if version in ['master', 'latest'] or version.startswith("v"):
self.stac_version = version
else:
self.stac_version = f"v{version}"
self.stac_file = stac_file.strip()
self.dirpath = tempfile.mkdtemp()
self.stac_spec_host = stac_spec_host
Expand Down Expand Up @@ -205,7 +208,11 @@ def run(self):
message["valid_stac"] = True
except ValidationError as e:
self.status[f"{self.stac_type}s"]["invalid"] += 1
message.update(self.create_err_msg("ValidationError", e.message))
if e.absolute_path:
err_msg = f"{e.message}. Error is in {' -> '.join([str(i) for i in e.absolute_path])}"
else:
err_msg = f"{e.message} of the root of the STAC object"
message.update(self.create_err_msg("ValidationError", err_msg ))

self.message.append(message)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_stac_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_bad_item_validation_v090_verbose():
"schema": "https://cdn.staclint.com/v0.9.0/item.json",
"valid_stac": False,
"error_type": "ValidationError",
"error_message": "'id' is a required property",
"error_message": "'id' is a required property of the root of the STAC object",
}
]

Expand Down