Skip to content

chore(schemas): migrate to JSON Schema 2020-12 - #112

Open
ucekmez wants to merge 1 commit into
feat/webhook-batchingfrom
chore/schemas-json-schema-2020-12
Open

chore(schemas): migrate to JSON Schema 2020-12#112
ucekmez wants to merge 1 commit into
feat/webhook-batchingfrom
chore/schemas-json-schema-2020-12

Conversation

@ucekmez

@ucekmez ucekmez commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

PR 20 of a stacked series. Base is #111. Not for merge without review.

Every schema declared http://json-schema.org/draft-07/schema#, while @eep-dev/setup-cli emits openapi: "3.1.0" documents that $ref those files.

OpenAPI 3.1's schema dialect is JSON Schema 2020-12. So generated descriptions referenced draft-07 schemas from a 2020-12 context — a dialect mismatch strict OpenAPI 3.1 tooling trips on, and one the canonical openapi.yaml from #109 inherits.

Migrating also unblocks the roadmap's "Schema → TypeScript / Pydantic codegen with a CI drift gate" item: most modern codegen targets 2020-12.

The migration is mechanical — and I checked the tree first

Rather than assuming, I enumerated the keywords that actually differ between the dialects:

Keyword Occurrences Action
definitions 8 $defs, plus every #/definitions/ pointer
array-form items 0 no prefixItems conversion needed
dependencies 0
additionalItems 0
exclusiveMinimum 3 already numeric form; unchanged between dialects

definitions is the one that matters silently. A file left using the old keyword validates as an unknown annotation rather than failing — its subschemas just stop being reachable, with no error. There's a new test pinning that neither "definitions" nor #/definitions/ reappears.

Validator changes

Ajv's default export only understands draft-07, so every validator construction moves to the ajv/dist/2020 build:

  • tests/test_schemas.test.ts, tests/conformance-fixtures.test.ts, tests/bench.test.ts
  • @eep-dev/compliance-cli/src/schemas.ts

Assertions that pinned the old dialect are updated rather than deleted — including the cross-impl Python one.

Scope

  • Spec / schema only
  • TypeScript package(s)
  • Python package(s)
  • Tests / CI
  • Docs / examples

Checklist

  • I read CONTRIBUTING.md and CODE_OF_CONDUCT.md.
  • Tests added or updated where appropriate.
  • Breaking change? No property, constraint or $id changed, so every document that validated before still validates. The $schema value changed on all 24 files, which downstream tooling pinned to draft-07 will notice — worth a CHANGELOG line. Consumers using Ajv will need the ajv/dist/2020 build, as this PR does internally.
  • Documentation updated for user-visible behavior.

Verification

Suite Result
tests/ 200 passed
@eep-dev/gates 491 passed
@eep-dev/middleware 259 passed
@eep-dev/compliance-cli 73 passed
@eep-dev/discovery 42 passed
@eep-dev/setup-cli 44 passed
tests/cross-impl/ 56 passed, 3 skipped
compliance-cli --fixtures 26 vectors, 0 failed
codegen-schema-types --check no drift
check-draft-schema-parity
openapi-route-parity

A repo-wide grep for draft-07 now returns only the explanatory comments about why the ajv/dist/2020 build is required.

Notes for reviewers

This deliberately sits near the end of the stack. It churns all 24 schemas, so putting it earlier would have made every subsequent schema-touching PR rebase through a dialect migration. Everything that adds properties (#100, #106, #107, #110, #111) lands first.

$id values are untouched — they still read https://eep.dev/schemas/v0.1/…. Changing them would be a genuine break for anyone resolving schemas by $id, and the dialect change does not require it.

Python side needs no change: nothing in the repo validates with jsonschema; the Python fixture harness compares recorded outcomes rather than compiling schemas. Worth knowing if that changes.

Every schema declared `http://json-schema.org/draft-07/schema#`, while
`@eep-dev/setup-cli` emits `openapi: "3.1.0"` documents that `$ref`
those files. OpenAPI 3.1's schema dialect *is* JSON Schema 2020-12, so
generated descriptions referenced draft-07 schemas from a 2020-12
context — a dialect mismatch that strict OpenAPI 3.1 tooling trips on,
and one that the canonical `openapi.yaml` inherits.

Migrating also unblocks the roadmap's "Schema → TypeScript / Pydantic
codegen with a CI drift gate" item: most modern codegen targets 2020-12.

The migration is mechanical and the tree was checked first for the
keywords that actually changed:

- `definitions` → `$defs` (8 occurrences) plus every `#/definitions/`
  pointer. This is the one that matters silently: a file left using the
  old keyword validates as an unknown annotation rather than failing, so
  its subschemas simply stop being reachable.
- No array-form `items`, so no `prefixItems` conversion was needed.
- No `dependencies` or `additionalItems`.
- `exclusiveMinimum` already used the numeric form, which is unchanged.

Ajv's default export only understands draft-07, so every validator
construction moves to the `ajv/dist/2020` build — `tests/`, the
benchmark suite, and the compliance CLI's schema registry.

Assertions that pinned the old dialect are updated rather than deleted,
and a new one pins that `definitions` and `#/definitions/` do not
reappear.

No property, constraint or `$id` changed, so every document that
validated before still validates.

Refs: EEP audit 2026-08 finding O6
Signed-off-by: Ugur Cekmez <ucekmez@gmail.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 19:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants