Closed pbordron closed 2 months ago
Hi. You haven't included any version information or what command you ran / what you installed, so it's hard to know what went wrong, but those examples are correct (and run without error here on the current version of jsonschema
), and the docs are doctested to ensure they stay correct hopefully.
Feel free to follow up with more info if need be, but otherwise you presumably have installed a very old version that doesn't match the one in the docs you're reading.
Oh! Indeed the example you sent is the one example not doctested, and has a typo, it's DRAFT202012
not DRAFT2020212
.
$ conda list jsonschema
# Name Version Build Channel
jsonschema 4.21.1 pyhd8ed1ab_0 conda-forge
jsonschema-specifications 2023.6.1 pyhd8ed1ab_0 conda-forge
jsonschema-with-format 4.21.1 pyhd8ed1ab_0 conda-forge
jsonschema-with-format-nongpl 4.21.1 pyhd8ed1ab_0 conda-forge
Still it produces an error on argument 'registry' listed in API
TypeError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry'
I've fixed the typo (and enabled doctesting for the example(s), I remember now that for that page I couldn't get things to properly syntax highlight when doctesting was enabled, but that appears fixed now).
Still it produces an error on argument 'registry' listed in API
That doesn't reproduce here.
What command are you running to install jsonschema
that reproduces that error?
OK, it was my fault.
An old jsonschema version out nowhere and installed with pip
was polluting my conda installation (maybe something managed by vscode)
jsonschema 4.17.3
Removing it solve the issue
Cool, thanks for the report.
I wanted to load some schemas in memory, but got following errors when reproducing the example:
ImportError: cannot import name 'DRAFT2020212' from 'referencing.jsonschema'
forTypeError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry'
forI didn't test other examples, but they might be also wrong.
Could you update the documentation to reflect current version of jsonschema?