summaryrefslogtreecommitdiff
path: root/jsonschema/_legacy_validators.py
Commit message (Collapse)AuthorAgeFilesLines
* flake8 -> ruff, a mostly painless affair.Julian Berman2023-03-151-1/+1
|
* 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.
* Resolve $ref using the referencing library.Julian Berman2023-02-211-25/+19
| | | | | | | | | | | | | | | | | | | | | | 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!
* Offload a small initial bit of id-related code to referencing.Julian Berman2023-02-211-13/+0
|
* Fix $id in the presence of $ref on draft 6 and 7.Julian Berman2022-08-281-0/+13
| | | | | | | | | | In these drafts, not only did $ref cause other validator keywords to be ignored, it prevents $id from setting the resolution scope too. In draft 3 and 4 this is now half-fixed in the sense that the correct URI is now the one that will be retrieved, but the logic for finding subschemas by ID is still broken on these drafts.
* Fix unevaluatedItems on draft2019.Julian Berman2022-08-201-0/+78
| | | | | | | | This was trivial, other than needing to copy paste the function which anyhow needs removal. It only didn't work previously because of the items -> prefixItems rename in draft2020.
* Prefer 'keyword' over 'validator' in docs.Julian Berman2022-08-161-3/+3
| | | | | | | | | | | | | | In newer JSON Schema specifications we've standardized more on this language rather than calling things validators (and such a thing already has plenty of overloaded meaning here). This commit doesn't do any deprecation, so there's still some awkwardness in that ValidationError.validator is the keyword which failed validation, and Validator.VALIDATORS is a mapping of keywords to callables. We may choose to do so later, but for now will save some API churn in case something else changes.
* Gut the meat of the recursiveRef implementation for draft2019Julian Berman2022-06-281-1/+5
| | | | | | | | | | It's buggy, and can lead to blowing up the stack with recursion errors. Done by (redundantly) checking schemas during test runs, even though the upstream test suite 'guarantees' they're valid. (Given that it uses this implementation to make that guarantee, bugs like the above went unnoticed.) Closes: #847
* Add Validator.evolve, deprecating passing _schema to methods.Julian Berman2021-08-251-2/+5
| | | | | | | | | | | | | | | | | | | | A Validator should be thought of as encapsulating validation with a single fixed schema. Previously, iter_errors and is_valid allowed passing a second argument, which was a different schema to use for one method call. This was mostly for convenience, since the second argument is often used during sub-validation whilst say, recursing. The correct way to do so now is to say: validator.evolve(schema=new_schema).iter_errors(...) validator.evolve(schema=new_schema).is_valid(...) instead, which is essentially equally convenient. Closes: #522
* Remove RefResolver.scopes_stack_copy.Julian Berman2021-08-251-2/+1
| | | | | | This makes the (anyhow-not-yet-working) dynamicRef validators access private state on ref resolvers, but that will be fixed when aforementioned not-working is fixed.
* Remove resolve_local.Julian Berman2021-08-241-1/+2
| | | | | We don't want to grow the public API of RefResolvers, they have enough issues already.
* yield from everywhere, saving precious linesJulian Berman2021-08-181-26/+16
|
* Remove types_msg which implements really old draft-3 behavior.Julian Berman2021-08-181-1/+8
| | | | | | Since then, types aren't objects, they're just strings. This just wastes time catching exceptions for newer drafts.
* Tidy up validation error messages, particularly using f-strings.Julian Berman2021-08-181-17/+14
|
* Remove more unneeded u prefixes.Julian Berman2021-08-181-2/+2
|
* May as well add support for Draft 2019 as well.Julian Berman2021-08-181-1/+17
| | | | recursiveRef is broken in the same way dynamicRef is.
* Fix missing trailing commas.draft2020-12Julian Berman2021-08-041-7/+6
| | | | Add flake8-commas to ensure this stays the case.
* Tidy the docstring slightly.Julian Berman2021-08-041-2/+5
|
* Julian/jsonschema#782: Add compatibility to draft7 and olderHarald Nezbeda2021-07-211-0/+12
|
* Julian/jsonschema#782: Code clenaup, fixes validation messagesHarald Nezbeda2021-07-211-4/+4
|
* Julian/jsonschema#782: Adapt validator test for draft2020-12, fixes code stylesHarald Nezbeda2021-07-201-3/+8
|
* Julian/jsonschema#782: Load dependencies from legacy validatorsHarald Nezbeda2021-07-201-0/+26
|
* Julian/jsonschema#782: Implements unevaluatedItems validationsHarald Nezbeda2021-07-191-0/+16
|
* Julian/jsonschema#782: Extend contains with minContains and maxContaints, ↵Harald Nezbeda2021-07-191-0/+10
| | | | add contains legacy validator
* Kill jsonschema.compat as well.Julian Berman2020-08-051-3/+2
|
* These are actually now no different than the current implementations.Julian Berman2019-03-031-44/+0
|
* Split out dependencies for draft 3.Julian Berman2019-01-141-0/+25
| | | | | | | | Draft 3 allowed simple string dependencies, but no later draft does. This also lets us use the same fix for boolean schema nonsense as we just did for items.
* Get these out of the way.Julian Berman2019-01-111-0/+160