Repository navigation
Add x-bblocks-metadata provenance key to annotated schemas - #97
Merged
Merged
Conversation
Annotated schemas now carry a root-level x-bblocks-metadata object with the bblock's itemIdentifier, version and dateOfLastChange, plus the published register.json URL when a base URL is known. This lets bblocks-aware tooling identify where a schema came from even if its URL is aliased or redirected, or it is encountered out of context. Clients treat it as a provenance claim and decide for themselves whether to trust it or to check for staleness. Keys already present under x-bblocks-metadata are kept, except for the ones generated here, which always override. The date is the git-derived dateOfLastChange rather than a generation time, so unchanged bblocks keep producing identical output. To have it available at annotation time, its computation moves out of do_postprocess() into resolve_date_of_last_change(), which is now also called at the start of the annotate step.
rob-metalinkage
approved these changes
Oct 20, 2026
rob-metalinkage
left a comment
Collaborator
There was a problem hiding this comment.
Looks sensible.
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.
What
Annotated schemas now carry a root-level
x-bblocks-metadataobject recording which bblock (and register) they were generated from. This lets bblocks-aware tooling identify a schema even if its URL is aliased, redirected or mirrored, or if the schema is encountered out of context (e.g. referenced by a non-bblock schema).Example, from an annotated schema:
itemIdentifier: the strong key; globally unique through the register's prefix.register: URL of the publishedregister.json. Only included when--base-urlis set. It is a hint: clients may ignore it and resolve the bblock from its identifier in some other way (e.g. a meta-register).version/dateOfLastChange: let a client judge staleness. The date is the existing git-deriveddateOfLastChange, not a generation time, so unchanged bblocks keep producing identical output. A client that cares about$ref'd dependencies can trace them itself.The key is a provenance claim, not proof: clients decide whether to trust it. It is written to the YAML, JSON and OAS 3.0 outputs, on both the normal annotation path and the
extensionPointspath. If a source schema already has anx-bblocks-metadataobject, extra keys in it are kept and the four generated keys override. It is applied to schemas only (not JSON-LD contexts, where an unknownx-key would be parsed as a term definition).Other changes
dateOfLastChangeused to be computed indo_postprocess(), after annotation. That logic moved intoresolve_date_of_last_change()(behavior unchanged), which is now also called at the start of the annotate step so the date is available when the schema is written.BuildingBlockRegistertakes a new optionalregister_url.tests/test_bblocks_metadata.py.Testing
bblocks-exampleson this branch and onmaster: both exit 0, produce the same set of output files and the same 13 pre-existing tracebacks (unresolvable$defspointers and an intentionaljq-errortransform test). All 24 annotated schemas on this branch have the new key.Downstream impact
build/output, since they all gain the new key. This is expected, and easy to spot as the only change in that commit.@v1-pinned consumers until a new release tag is cut; merging tomasteralone doesn't change production behavior.cc @rob-metalinkage