Skip to content

Commit afb1b9c

Browse files
committed
add validator engine field
1 parent 898cec0 commit afb1b9c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/)
99
### Added
1010
- Added detailed recursive validation summary showing validation counts by STAC object type (Catalog, Collection, etc.)
1111
- Added validation duration timing that shows total processing time in a human-readable format
12+
- Added support for pydantic validation in recursive mode with proper schema reporting
1213

1314
### Changed
1415
- Standardized summary output formatting across all validation modes for consistency

stac_validator/validate.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,16 @@ def recursive_validator(self, stac_type: str) -> bool:
575575
self.schema = set_schema_addr(self.version, stac_type.lower())
576576
message = self.create_message(stac_type, "recursive")
577577
message["valid_stac"] = False
578+
# Add validator_engine field to track validation method
579+
message["validator_engine"] = "pydantic" if self.pydantic else "jsonschema"
578580

579581
try:
580582
if self.pydantic:
581-
# pydantic_validator will set its own schema message
583+
# Set pydantic model info in schema field
584+
model_name = f"stac-pydantic {stac_type.capitalize()} model"
585+
message["schema"] = [model_name]
586+
# Run pydantic validation
582587
msg = self.pydantic_validator(stac_type)
583-
message["schema"] = msg["schema"]
584588
else:
585589
msg = self.default_validator(stac_type)
586590
message["schema"] = msg["schema"]
@@ -682,11 +686,14 @@ def recursive_validator(self, stac_type: str) -> bool:
682686
if link["rel"] == "item":
683687
self.schema = set_schema_addr(self.version, stac_type.lower())
684688
message = self.create_message(stac_type, "recursive")
689+
message["validator_engine"] = "pydantic" if self.pydantic else "jsonschema"
685690
try:
686691
if self.pydantic:
687-
# Use pydantic validator for child items
692+
# Set pydantic model info in schema field for child items
693+
model_name = f"stac-pydantic {stac_type.capitalize()} model"
694+
message["schema"] = [model_name]
695+
# Run pydantic validation
688696
msg = self.pydantic_validator(stac_type)
689-
message["schema"] = msg["schema"]
690697
elif self.version == "0.7.0":
691698
schema = fetch_and_parse_schema(self.schema)
692699
# Prevent unknown url type issue

0 commit comments

Comments
 (0)