hyperjump-io / json-schema

JSON Schema Validation, Annotation, and Bundling. Supports Draft 04, 06, 07, 2019-09, 2020-12, OpenAPI 3.0, and OpenAPI 3.1
https://json-schema.hyperjump.io/
MIT License
216 stars 22 forks source link

JsonType missing "integer" as an allowed value #18

Closed dan-j closed 1 year ago

dan-j commented 1 year ago

Currently the definition of JsonType is as follows: https://github.com/hyperjump-io/json-schema-core/blob/c808bedbb80e90b649b263c92c38df23a32e87bb/lib/common.d.ts#L1

I've haven't read all the specs, but draft-07 and 2020-12 have identical definitions for "type":

String values MUST be one of the six primitive types ("null", "boolean", "object", "array", "number", or "string"), or "integer" which matches any number with a zero fractional part.

It appears "integer" is missing from the definitions.

Links to the specifications:

jdesrosiers commented 1 year ago

That type intentionally only includes JSON types, which doesn't include "integer".

However, it appears I have incorrectly used that type in the Schema types such as, https://github.com/hyperjump-io/json-schema-validator/blob/main/lib/draft-2020-12.d.ts#L51. I'll need to define a new type to use in the schema types.

Thanks for bringing reporting this issue!