-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Enable combined JSON Schema and Pydantic validation
Background
Currently, the STAC validator offers two separate validation approaches:
- Traditional JSON Schema validation (default)
- STAC-Pydantic model validation (via the
--pydantic
flag)
These approaches are implemented as mutually exclusive options in the codebase, where using --pydantic
bypasses the default JSON Schema validation.
Problem
Users cannot benefit from both validation methods simultaneously. Each method has unique strengths:
- JSON Schema validation thoroughly checks against the official STAC schemas
- Pydantic validation provides enhanced type checking and more contextual error messages
By forcing users to choose one or the other, we're missing an opportunity to provide more comprehensive validation.
Proposed Solution
Modify the validator to allow both validation methods to run in sequence when desired:
- Add a new option like
--validate-all
or update the behavior of--pydantic
to run both validations - Aggregate and deduplicate validation results from both methods
- Present a unified validation report that clearly indicates which issues were found by which validator
Benefits
- More thorough validation by leveraging the strengths of both approaches
- Better error detection and reporting
- Enhanced user confidence in validation results
Implementation Considerations
- The default behavior should remain unchanged for backward compatibility
- Performance impact of running both validations should be acceptable
- The validation results format should clearly distinguish between issues found by each method
- Consider how to handle conflicting validation results
Related Work
This enhancement builds on the Pydantic integration added in v3.7.0 and would make the validator more powerful by combining both validation approaches.
Metadata
Metadata
Assignees
Labels
No labels