Add standalone schema resolution and comparison tools#62
Open
smrgeoinfo wants to merge 1 commit intoopengeospatial:masterfrom
Open
Add standalone schema resolution and comparison tools#62smrgeoinfo wants to merge 1 commit intoopengeospatial:masterfrom
smrgeoinfo wants to merge 1 commit intoopengeospatial:masterfrom
Conversation
Standalone Python tools for building block authors to produce fully-resolved, self-contained JSON Schemas from source files and to check YAML/JSON schema consistency. - resolve_schema.py: recursively resolves all $ref (relative, fragment, cross-file, and bblocks:// URI) into a single inlined JSON Schema for validation and tooling integration - compare_schemas.py: compares schema.yaml against companion JSON schemas, reporting structural inconsistencies - tools/README.md: usage docs, option reference, examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two standalone Python tools under
tools/for building block authors to work with schemas locally, without running the full Docker postprocess pipeline.tools/resolve_schema.py— Recursively resolves all$refreferences into a single fully-inlined, self-contained JSON Schematools/compare_schemas.py— Comparesschema.yamlsource files against companion JSON schemas, reporting structural inconsistenciestools/README.md— Usage documentation with examples and option referenceMotivation
The postprocess Docker tool generates annotated schemas in
build/annotated/, but these still contain$refreferences to remote URLs. Building block authors currently have no standard way to produce a fully-resolved, self-contained JSON Schema from their source files — useful for:jsonschema.validate(data, resolved_schema))These tools complement the postprocess pipeline by providing a lightweight, standalone alternative that works directly on
_sources/without Docker.$refpatterns handled byresolve_schema.py$ref: ../detailEMPA/schema.yaml$ref: '#/$defs/Identifier'$ref: ../metaMetadata/schema.yaml#/$defs/conformsTo_itembblocks://URI:$ref: bblocks://ogc.geo.features.feature— resolved locally viabblocks-config.yamlidentifier-prefixTesting
Tested against:
opengeospatial/bblocks— 12 building blocks indexed, all localbblocks://refs fully resolved (including$defsfragment refs likebblocks://ogc.ogc-utils.iri-or-curie#/$defs/MultipleOrObjectOrNull)opengeospatial/bblock-template— resolvesmySchemaandmyFeatureexample building blockscompare_schemas.pychecks 100 YAML/JSON pairs, all consistentRelated PRs
🤖 Generated with Claude Code