Skip to content
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

Type integer confusing? #272

Closed
we-zhang opened this issue Mar 15, 2017 · 4 comments
Closed

Type integer confusing? #272

we-zhang opened this issue Mar 15, 2017 · 4 comments

Comments

@we-zhang
Copy link

In the spec, it only list below types:
null,
boolean,
string,
number,
object,
array.

I know number includes integer, but can I define a "type":"integer" explicitly. I mean will this violate the spec?

@handrews
Copy link
Contributor

@Weching "integer" was accidentally left out of that list in draft-wright-jsonschema-00. This is fixed in the next draft, which is currently in final review and should be published in the next week or so.

You should use "type": "integer" as if it were in the list of defined types. It's omission was just an error.

@boxy-robot
Copy link

boxy-robot commented Dec 19, 2018

Can we fix this typo? I'm just getting started with json schema and was very confused why everything but the latest official docs reference an integer type.

https://json-schema.org/latest/json-schema-core.html#rfc.section.4.2.1

Edit: Actually, after reading this bit I think I may be more confused now:

As an example, "integer" is a reasonable type for a vocabulary to define as a value for a keyword, but the data model makes no distinction between integers and other numbers.

@handrews
Copy link
Contributor

@yellottyellott what that means is that it's fine that the type keyword includes "integer" as a value, but in terms of the JSON data model as interpreted by JSON Schema, based on the JSON RFC, "integer" is not a distinct type.

You will see in the definition of the type keyword that it notes how "integer" is a special case as well. So the two specification documents are in agreement.

@boxy-robot
Copy link

Ah, thanks @handrews. The latter link is what I was looking for.

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

No branches or pull requests

3 participants