| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
(We no longer support it.)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
| |
It will imminently be replaced by referencing.Registry-based
resolution.
|
|
|
|
|
|
| |
Internal uses of it will be removed, replaced with referencing's
resolution APIs, though RefResolver will continue to function during
its deprecation period.
|
| |
|
| |
|
| |
|
|
|
|
| |
Ref: #590
|
|
|
|
| |
They aren't necessarily dicts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sphinx appears to 'helpfully' silently truncate the line if
any text is put on the same line as the exception, i.e.:
Raises:
foo, if bar
just silently produces:
foo -
and throws the line away...
|
|
|
|
|
| |
Also rely more on sphinx's type annotation support, which
seems to detect the argument types without duplicating.
|
|
|
|
|
|
|
|
|
| |
iter_errors returns an iterable, and doesn't guarantee it's an
iterator (this is present in the text documentation).
And instances are any Python object, not just dicts.
(CC @sirosen just FYI and in case I made some silly error).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
In other words, a draft 7 schema may reference a draft 2019 schema
(or vice versa), and now correctly apply the 2019 rules within the
referenced schema.
Refs: json-schema-org/JSON-Schema-Test-Suite#587
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Nitpick was failing on
TYPE_CHECKER: ClassVar[TypeChecker]
It's not clear what to do about this. `TypeChecker` was imported
correctly from `jsonschema._types` and is noted in the doc as
`jsonschema.TypeChecker`. We can't import the `jsonschema` name at
runtime because that would be circular.
To resolve, use `typing.TYPE_CHECKING` to conditionally import
`jsonschema` at type-checking time. This avoids the circular
import but allows us to write
TYPE_CHECKER: ClassVar[jsonschema.TypeChecker]
As a result, Sphinx correctly builds a cross-reference from the
annotation, the annotation is still accurate, and runtime behavior
is left untouched.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use of the `__future__` import of annotations allows several niceties,
in particular:
- parametrization of builtin types as generics
- `|` syntax for unions (including `| None` for optionals)
Update to use the future import wherever it improves or simplifies
annotations.
Avoid using new typing features outside of annotations (e.g. in
assignment), which fails on older pythons. This is an unfortunate
wart in the way that the future import works.
|
|
|
|
|
|
|
| |
mypy can handle `if sys.version_info` checking better than
`try ... except ImportError`. This is somewhat disappointing, but the
rewrite of these import lines isn't that bad and aligns with the
recommendations of the mypy docs.
|
| |
|
| |
|
|
|
|
|
|
| |
Primarily, rewrite `IValidator` to `Validator`
Co-authored-by: Julian Berman <Julian@GrayVines.com>
|
|
This is a Protocol implementation for type checking under mypy and
other static analyzers. It uses the protocol class defined in py3.8+
and uses typing_extensions as a backport for py3.7
The documentation-only validator class has been replaced with the
protocol, and docs are now driven via autoclass on the protocol.
Importantly, several documented methods of the class have been
removed, as they were marked deprecated under jsonschema v3.0 and are
no longer provided by the builtin validators.
Minor adjustments to the docs are made to repoint references at the
new class definition.
|