Add schema resolution and comparison tools#8
Open
smrgeoinfo wants to merge 1 commit intoopengeospatial:masterfrom
Open
Add schema resolution and comparison tools#8smrgeoinfo 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 _sources/ 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 was referenced Feb 15, 2026
Open
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
tools/resolve_schema.py— Recursively resolves all$refreferences from modular YAML/JSON source schemas into a single fully-inlined, self-contained JSON Schema. Handles relative paths, fragments, cross-file fragments, andbblocks://URI cross-building-block references (viabblocks-config.yamlidentifier-prefix).tools/compare_schemas.py— Comparesschema.yamlsource files against companion JSON schemas for each building block, reporting structural inconsistencies (missing properties, type mismatches, constraint differences, description drift). Skips expected$refpath differences.tools/README.md— Usage documentation with examples, option reference tables, and comparison withbblocks-postprocess.Motivation
The
bblocks-postprocessDocker tool generates annotated schemas inbuild/annotated/, but these still contain$refreferences to remote URLs. There is currently no standard way for building block authors to produce a fully-resolved, self-contained JSON Schema suitable for local validation, tooling integration, or inspection. These tools fill that gap as lightweight standalone Python scripts.Key features
_sources/myBlock/) and nested (_sources/category/myBlock/) directory layoutsbblock.jsonpresencebblocks://cross-building-block references locally (including#/$defs/fragment pointers)_sources/directory relative to script location or CWDpyyamlTesting
Tested against:
opengeospatial/bblocks— 12 building blocks indexed, all localbblocks://refs resolved (including$defsfragment refs likebblocks://ogc.ogc-utils.iri-or-curie#/$defs/MultipleOrObjectOrNull)bblock-templateitself — resolvesmySchemaandmyFeatureexample building blockscompare_schemas.pychecks 100 YAML/JSON pairs, all consistentTest plan
python tools/resolve_schema.py --bblock mySchemafrom the template repo rootpython tools/compare_schemas.pyfrom the template repo rootopengeospatial/bblocksand runpython tools/resolve_schema.py --bblock feature --sources-dir registereditemsbblocks://refs resolve correctly (e.g.,topologyreferencesiri-or-curie)🤖 Generated with Claude Code