jsonschema icon indicating copy to clipboard operation
jsonschema copied to clipboard

Emit a warning when schemas are missing $schema properties

Open Julian opened this issue 6 years ago • 4 comments

This seems to be something schema authors often err on. Might as well show them a warning.

Of course, they're unlikely to see it given that Python makes warnings invisible, but hey, security theater works, why not validation theater.

Julian avatar Jan 03 '19 16:01 Julian

I plan to add a warning to the validator_for function. The result displayed after implementation is:

validators.py:965: UserWarning: missing $schema properties

I wonder if this meets the requirements?

willson-chen avatar Jul 21 '20 07:07 willson-chen

@willson-chen let's focus on the PRs you sent already -- if we can get them to completion definitely seems like we can figure this one out.

Julian avatar Jul 21 '20 12:07 Julian

@Julian Do you think the results mentioned above have met your expectations?

willson-chen avatar Jul 28 '20 01:07 willson-chen

Probably at this point safe to define a ValidationWarning, but otherwise yes looks reasonable -- we should elaborate on the message there and link to the specification/information on what $schema is and why you should provide it too.

Julian avatar Jul 29 '20 18:07 Julian

This is being discussed upstream (in the spec) and may effectively end up being moot, either because we only really have one used value for $schema going forward or because the behavior when it's missing becomes defined differently. Going to close for now.

Julian avatar Jun 01 '23 13:06 Julian