nickcmaynard / jsonschemalint

JSON Schema Lint. Like you I'm busy, so pull requests will get merged quicker than feature requests are implemented.
https://jsonschemalint.com
MIT License
80 stars 31 forks source link

Allow unknown formats #49

Open tewe opened 5 years ago

tewe commented 5 years ago

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.

nickcmaynard commented 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

handrews commented 5 years ago

@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.

nickcmaynard commented 5 years ago

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.