jsonschemalint icon indicating copy to clipboard operation
jsonschemalint copied to clipboard

Allow unknown formats

Open tewe opened this issue 6 years ago • 3 comments

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.

tewe avatar Jan 24 '19 07:01 tewe

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 avatar Feb 23 '19 22:02 nickcmaynard

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

handrews avatar Feb 24 '19 02:02 handrews

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.

nickcmaynard avatar Feb 24 '19 08:02 nickcmaynard