Repository navigation
feat(json-schema-document): infer no type from OpenAPI number formats - #11123
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-number-formats
branch
2 times, most recently
from
October 28, 2026 12:38
50c0732 to
fb28ecc
Compare
For a schema without "type", the json-schema-2020-12 renderer infers
integer from the formats int32 and int64, and number from float and
double. OpenAPI defines these formats; JSON Schema 2020-12 doesn't, so
in a standalone document { "format": "int32" } was shown as integer
although any type is valid.
JSONSchemaDocument's renderer instance now takes its own getType, a copy
of the json-schema-2020-12 one (kept in step by a unit test) in which
those four formats imply no type: neither integer/number nor the string
that any other format implies. An explicit type and the other
inferences are unchanged. The shared getType is untouched, so OpenAPI
3.1/3.2 Schema Objects still show integer and number.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robert-hebel-sb
force-pushed
the
feat/json-schema-2020-12-number-formats
branch
from
October 29, 2026 11:12
fb28ecc to
fca6d49
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
In a standalone document, the formats
int32,int64,floatanddoubleno longer implyinteger/numberfor a schema withouttype. The json-schema-document renderer instance gets its owngetType; the shared one is untouched, so OpenAPI 3.1/3.2 behavior is unchanged.Part 4 of 5 of a stack on top of #11117 (standalone JSON Schema 2020-12).
Motivation and Context
These formats are defined by OpenAPI, not by JSON Schema 2020-12, so
{ "format": "int32" }was shown as integer although any type is valid.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