Open tewe opened 5 years ago
Closing this. AFAICS format
applies only to string
types, not number
- see https://json-schema.org/understanding-json-schema/reference/string.html?highlight=format and https://json-schema.org/understanding-json-schema/reference/numeric.html
@nickcmaynard format
can apply to anything. The current standardized formats only apply to strings, but as you can see in individual format value subsections, each subsection notes that its values apply only to strings.
The format
keyword itself can apply to any type. Specifically:
A format attribute can generally only validate a given set of instance types. If the type of the instance to validate is not in this set, validation for this format attribute and instance SHOULD succeed.
Note that there is no restriction on which type or types to which a given format
value applies.
OK, thank you. Probably we need some sort of settings area with the ability to flip format validation on and off. Will leave this here until someone sends me a PR, or I have time.
JSON Schema seems to allow
{"type": "number", "format": "float"}
but it causes this linter to fail. It would be nice if unknown formats could be ignored.