cwacek / python-jsonschema-objects

Automatic Python binding generation from JSON Schemas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Valid schemas are not accepted ("UserWarning: schema ... not recognized")

reece opened this issue · comments

https://json-schema.org/understanding-json-schema/reference/schema.html says that all of the following should be valid $schema values:

  • http://json-schema.org/schema#
  • http://json-schema.org/draft-07/schema#
  • http://json-schema.org/draft-06/schema#
  • http://json-schema.org/draft-04/schema#

https://json-schema.org/draft/2019-09/json-schema-core.html has an example with:

  • https://json-schema.org/draft/2019-09/schema

python_jsonschema_objects doesn't accept any of these values. The only allowed values are those in

As a result, valid schemas give this error:

.../python_jsonschema_objects/__init__.py:54: UserWarning: Schema version http://json-schema.org/schema# not recognized. Some keywords and features may not be supported.
  self.schema["$schema"]

This is specifically a suppressible warning because if you're using a schema other than the ones in SUPPORTED_VERSIONS, it's possible that not all functionality will be supported properly.

If you don't want to see these messages, add a warningfilter to your code as described in https://docs.python.org/3/library/warnings.html