Skip to content

docs(schema): record schema version 1.1.0 via $comment - #31

Merged
OliEder merged 1 commit into
mainfrom
feat/schema-version-field
Aug 27, 2026
Merged

OliEder merged 1 commit into
mainfrom
feat/schema-version-field

Conversation

@OliEder

@OliEder OliEder commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes schema/v1.json self-describing about its version — you asked whether the schema shouldn't carry its version. It should, and now does, via $comment.

Why not a version field?

version is not a standard keyword in any JSON Schema draft (07, 2019-09, or 2020-12 — verified against the spec's annotation-keyword list). A custom top-level version breaks AJV strict mode, which both this repo's validate script and downstream AJV consumers (renderer, validator) use — it errors with strict mode: unknown keyword: "version" and fails the suite. Upgrading the JSON Schema draft would not help, since no draft adds a version keyword.

Why not the filename?

The $id/filename stays v1.json deliberately: it's the schema's canonical identity and the major compatibility line. 1.1.0 is a backwards-compatible (additive) change, so every document's existing "$schema": ".../schema/v1.json" stays valid. Renaming to v1.1.json would 404 all 44 existing documents and force every future doc to know the exact minor. Version-pinned copies already live at /<version>/ocf-action-v1.json.

The fix

$comment is the official draft-07 annotation keyword for non-validating notes. It records the version (1.1.0) and the $id-stays-v1 / versioned-URL convention, with zero tooling changes.

Test Plan

  • npx ajv compile --strict passes (schema valid)
  • All tracked examples validate; 12 invalid fixtures rejected; 5 position tests pass

🤖 Generated with Claude Code

Make the schema artifact self-describing about its version. JSON Schema has no
standard 'version' keyword in any draft (07/2019-09/2020-12), and a custom
top-level 'version' breaks AJV strict mode (used by the validate script and by
downstream AJV consumers). $comment is the official draft-07 annotation keyword
for non-validating notes, so it carries the version + the v1-$id/versioned-URL
convention without any tooling change. Full suite stays green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@OliEder
OliEder merged commit 858730a into main Aug 27, 2026
2 checks passed
@OliEder
OliEder deleted the feat/schema-version-field branch August 29, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant