jsonschema
jsonschema copied to clipboard
Emit a warning when schemas are missing $schema properties
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.
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 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 Do you think the results mentioned above have met your expectations?
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.
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.