-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define type: "integer"
#4042
Define type: "integer"
#4042
Conversation
Part of OAI#4038
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we defining integer instead of leaving it to JSON Schema, which is very precise on this matter?
This is a good question, although it comes a little too late. OAS 3.0.0 to 3.1.0 all explicitly define "integer" as an allowed value of the type keyword in section Data Types:
This PR only tries to make the existing definition more precise and mention this extension in the Schema Objects section in addition to the Data Types section. We cannot remove this feature in a minor version, let alone a patch version. |
What OpenAPI does with "integer" and formats can't change JSON Schema. It doesn't matter if it's been that way in the spec and not been noticed or not. |
I think the correct thing to do here is to note that JSON Schema only scopes formats to its data model types (number, string, boolean, null, object, array), and therefore the text of the OAS has been corrected to use "number" rather than "integer". We can add wording to the effect that this has nothing to do with the Since this is a very tricky area, I would be happy to write up a PR that aligns with JSON Schema. |
Posted PR #4045 |
in favor of OAI#4045
@@ -173,7 +173,7 @@ Note that no aspect of implicit connection resolution changes how [URLs are reso | |||
### Data Types | |||
|
|||
Data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). | |||
Note that `integer` as a type is also supported and is defined as a JSON number that is a multiple of 1. | |||
Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to backport the language about mathematical integers from #4045
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch the previous comment- I did not realize this was in the Schema Object section (there are way too many PRs and issues on this at once right now). I am strongly against this change. The presence of "integer" as a value for type
is standard JSON Schema and should not be repeated. That just adds to confusion by including it in a list of exceptions when it is not an exception.
Part of
type: "integer"
in definition of Schema Object #4038