Reputation: 1084
In the spec http://json-schema.org/latest/json-schema-core.html, 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?
Upvotes: 4
Views: 4354
Reputation: 7677
Yes, you can use {"type": "integer"}
in the schema.
See:
https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-04#section-3.5
https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00#section-5.5.2
Upvotes: 3