summaryrefslogtreecommitdiff
path: root/jsonschema
Commit message (Collapse)AuthorAgeFilesLines
* Fix an additional unintentional resolution scope change in RefResolverv4.18.0a6Julian Berman2023-04-272-8/+18
| | | | Closes: #1085
* Re-enable (but deprecate) automatic reference retrieval.Julian Berman2023-04-252-7/+33
| | | | | | | | | | | | | Changing this without deprecation is backwards incompatible, so we re-introduce a warning. This only applies if you have not configured neither a Registry nor a legacy RefResolver. Both of the former 2 cases already have 'correct' behavior (the former will not automatically retrieve references and is not backwards incompatible as it is a new API, and the latter will do so but is already fully deprecated by this release). Cloess: #1089
* Ignore non-str $ids for *deprecated* RefResolver resolution.v4.18.0a5Julian Berman2023-04-252-3/+13
| | | | | | | | | | | | | The new referencing behavior is more correct (which is why it exists), but also means that even though `RefResolver` was/is untouched, it can be called now with more subschemas than previously, and in some cases that tickles this code to blow up (see the closed issue for a specific example). We simply now ignore non-strs, as doing so is no more wrong than this code used to be. Closes: #1085
* Wrap raised referencing exceptions in a RefResolutionError subclass.v4.18.0a4Julian Berman2023-04-173-1/+50
| | | | | | | | | | | | Even though RefResolutionError is deprecated (and already raises a suitable warning), this should make some additional code warn rather than blow up (i.e. if someone is catching RefResolutionError, that code should continue to work though it will raise a warning). Users can transition to non-deprecated APIs by directly catching referencing.exceptions.Unresolvable. Closes: #1069
* Merge pull request #1075 from ↵Julian Berman2023-03-281-16/+9
|\ | | | | | | | | ikonst/2023-03-27-unevaluatedProperties-do-not-validate Don't evaluate properties twice on behalf of `unevaluatedProperties` validation
| * lintIlya Konstantinov2023-03-281-4/+3
| |
| * lintIlya Konstantinov2023-03-271-3/+4
| |
| * Do not validate for unevaluatedPropertiesIlya Konstantinov2023-03-271-13/+6
| |
* | fix: Python 3.11 date.fromisoformat() allows extra formatsJyrki Muukkonen2023-03-281-1/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | Python 3.11 and later allow additional ISO8601 formats in `datetime` module ISO8601 parsing. These formats are not RFC3339 section 5.6 compliant. Especially `datetime.date.fromisoformat()` now allows strings like: * `20230328` (2023-03-28) * `2022W527` (2023-01-01) * `2023-W01` (2023-01-02) * `2023-W13-2` (2023-03-28) Fix by doing a regular expression check before passing the value to `datetime` module. This made the original `.isascii()` check unnecessary. See: * https://docs.python.org/3/whatsnew/3.11.html#datetime * https://github.com/python/cpython/commit/1303f8c927 * https://docs.python.org/3.11/library/datetime.html#datetime.date.fromisoformat * https://www.rfc-editor.org/rfc/rfc3339#section-5.6 Tests covering the invalid values to be sent to json-schema-org/JSON-Schema-Test-Suite Fixes #1056.
* Always pass a URI to referencing.jsonschema.specification_with.Julian Berman2023-03-231-1/+1
| | | | (This could previously be None incorrectly).
* Bump the minimum jsonschema-specifications/rpds versions to avoid #1059v4.18.0a2Julian Berman2023-03-201-0/+31
| | | | | This should re-enable validating from a thread other than the one that originall imported jsonschema.
* documentation mistype fixAryan Arora2023-03-201-1/+1
| | | Draft202012Validator.validate instead of Draft20212Validator.validate
* Enable ruff's simplify rules too.Julian Berman2023-03-154-31/+19
|
* flake8 -> ruff, a mostly painless affair.Julian Berman2023-03-1510-34/+41
|
* Remove a codepath meant for 3.7.Julian Berman2023-03-151-14/+8
| | | | (We no longer support it.)
* Newer attrs API in validators.py and some type hints for create.Julian Berman2023-03-153-29/+69
|
* Ignore additionalItems when items isn't present on 2019.Julian Berman2023-03-141-3/+3
| | | | This is specified behavior, see json-schema-org/JSON-Schema-Test-Suite#643.
* Speed up Validator.evolve by pre-computing fields.Julian Berman2023-03-061-17/+61
| | | | | | | | We're not a general class, so we know what fields we need ahead of time. This seems to give ~15% speedup on Validator evolution, which happens often as part of walking up and down schemas.
* Replace the other usages of pyrsistent with rpds.Julian Berman2023-03-063-21/+15
|
* Three more exception-related deprecations.Julian Berman2023-02-237-19/+106
| | | | | | | | | | | | | * RefResolutionError is deprecated entirely. Use referencing.Registry-based APIs, and catch referencing.exceptions.Unresolvable if you really want to ignore referencing related issues. * FormatError should now be imported from jsonschema.exceptions only, not from the package root. * ErrorTree should now be imported from jsonschema.exceptions only, not from the package root.
* Improve error messages for deprecation tests when they fail.Julian Berman2023-02-231-107/+37
|
* Re-add the direct test of RefResolver's deprecation.Julian Berman2023-02-231-0/+14
|
* StyleJulian Berman2023-02-221-2/+0
|
* These pass now actually.Julian Berman2023-02-221-6/+2
| | | | Closes: #523
* Tighten up a type in the tests.Julian Berman2023-02-211-3/+3
|
* Fix the benchmark to pass the right type for remotes again.Julian Berman2023-02-211-2/+2
|
* Flail to get Sphinx to find references again.Julian Berman2023-02-212-6/+5
|
* Resolve $ref using the referencing library.Julian Berman2023-02-217-382/+131
| | | | | | | | | | | | | | | | | | | | | | Passes all the remaining referencing tests across all drafts, hooray! Makes Validators take a referencing.Registry argument which users should use to customize preloaded schemas, or to configure remote reference retrieval. This fully obsoletes jsonschema.RefResolver, which has already been deprecated in a previous commit. Users should move to instead loading schemas into referencing.Registry objects. See the referencing documentation at https://referencing.rtfd.io/ for details (with more jsonschema-specific information to be added shortly). Note that the interface for resolving references on a Validator is not yet public (and hidden behind _resolver and _validate_reference attributes). One or both of these are likely to become public after some period of stabilization. Feedback is of course welcome!
* Move Validator._resolver to _ref_resolver.Julian Berman2023-02-211-17/+17
| | | | | | | | | | | Makes way for our newer resolver to live in the shorter name. (This should have no effect on the public API, where we have Validator.resolver returning this attribute after emitting a deprecation warning.) Also bumps the minimum attrs version we depend on, as we need the alias functionality.
* Make an evolve test not refer to reference resolution.Julian Berman2023-02-211-7/+14
| | | | Just avoids a deprecation warning when we switch over.
* Deprecate Validator.resolver.Julian Berman2023-02-214-6/+39
| | | | | It will imminently be replaced by referencing.Registry-based resolution.
* Move reference resolution to a (private) Validator method.Julian Berman2023-02-213-50/+63
| | | | | | | | | | | | | | This will make it easier to swap over to referencing's Resolver (while preserving backwards compat for anyone who passes a RefResolver to a Validator). At some point in the future this method may become public (which will make it easier for external dialects to resolve references) but let's keep it private for a bit until it's clear that the interface is stable -- a future draft might do crazy things like have adjacent properties to $ref affect the resolution behavior, which would make this method need to take more than just the $ref value.
* Inline a function that will be RefResolver specific.Julian Berman2023-02-211-9/+6
|
* Offload a small initial bit of id-related code to referencing.Julian Berman2023-02-212-29/+14
|
* Minor regrouping of some to-be-modified/deprecated RefResolver tests.Julian Berman2023-02-211-32/+32
|
* Load the test suite into a referencing.Registry for running tests.Julian Berman2023-02-211-5/+32
|
* Deprecate jsonschema.RefResolver from both places it is importable.Julian Berman2023-02-217-26/+53
| | | | | | Internal uses of it will be removed, replaced with referencing's resolution APIs, though RefResolver will continue to function during its deprecation period.
* Move to retrieving schemas from the jsonschema-specifications registry.Julian Berman2023-02-2122-1346/+22
| | | | Still will be tweaked as the referencing library's public API changes.
* Style, and don't interfere with a test.Julian Berman2023-02-211-1/+1
|
* Add a microbenchmark for validator creation.Julian Berman2023-02-211-0/+14
|
* Don't leak into _VALIDATORS during tests either.Julian Berman2023-02-151-0/+11
|
* More specific type.Julian Berman2023-02-151-1/+2
|
* Fix some (irrelevantly) broken JSON pointers in CLI tests.Julian Berman2023-02-091-2/+2
|
* Minor spelling and style.Julian Berman2022-12-262-5/+6
|
* Remove some old test skips that should never be triggered.Julian Berman2022-12-221-29/+5
| | | | PEP 393 removed narrow builds way back in 3.3.
* Merge pull request #1022 from DanielNoord/error-strJulian Berman2022-12-211-1/+8
|\ | | | | Add annotations for `_Error`
| * Use ``ClassVar`` for ``_Error`` attributesDaniël van Noord2022-12-211-51/+36
| |
| * Add ``_VerboseError``Daniël van Noord2022-11-301-33/+55
| |
* | Handle the upstream change to the previously broken draft 3 test.Julian Berman2022-12-211-1/+0
| |
* | Add a few examples of jsonschema.validators.validator_for.Julian Berman2022-12-191-0/+37
| |