Repository navigation
feat(json-schema-document): render definitions like $defs - #11120
Draft
robert-hebel-sb wants to merge 1 commit into
Draft
robert-hebel-sb wants to merge 1 commit into
robert-hebel-sb wants to merge 1 commit into
Conversation
robert-hebel-sb
force-pushed
the
feat/json-schema-2020-12-definitions
branch
from
October 28, 2026 12:36
ad17980 to
c7edc89
Compare
This was referenced Oct 28, 2026
The JSON Schema 2020-12 default meta-schema keeps "definitions" from earlier drafts, and implementations SHOULD assume that it behaves like "$defs" when that meta-schema is used (validation specification, Appendix A). A standalone 2020-12 document now renders it like $defs, right after it, instead of hiding it as an extension keyword. JSONSchemaDocument's renderer instance takes the dialect's overrides (overrides.ts): definitions in its keyword list, an isExpandable that counts it (a copy of the json-schema-2020-12 one, kept in step by a unit test), and Keyword$defs followed by a Definitions component (a copy of $defs). The shared json-schema-2020-12 renderer is untouched, and OpenAPI 3.1/3.2 rendering is unchanged: in an OpenAPI 3.1 Schema Object, definitions stays an extension keyword. A $ref into definitions is resolved; a $ref inside it stays as written, because swagger-client's json-schema-2020-12-apidom strategy doesn't dereference there (ApiDOM's 2020-12 namespace drops the keyword). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robert-hebel-sb
force-pushed
the
feat/json-schema-2020-12-definitions
branch
from
October 28, 2026 12:38
c7edc89 to
3ec9244
Compare
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.
Description
A standalone 2020-12 document now renders
definitionslike$defs, right after it, instead of hiding it as an extension keyword. The overrides live in the json-schema-document renderer instance only; the shared json-schema-2020-12 renderer and OpenAPI 3.1/3.2 rendering are unchanged.Part 1 of 5 of a stack on top of #11117 (standalone JSON Schema 2020-12). The whole stack is blocked until the swagger-client release it needs is published.
Motivation and Context
The 2020-12 default meta-schema keeps
definitionsfrom earlier drafts, and implementations SHOULD assume it behaves like$defs(validation specification, Appendix A).How Has This Been Tested?
npm run test:unit -- test/unit/core/plugins/json-schema-document) and ESLint on the plugin and its tests passed locally on this branch, while the local swagger-client tarballs were still in place.Screenshots (if appropriate):
Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests