Skip to content

jsonschema 4.18 compatibility #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openapi_schema_validator/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def handle_discriminator(
return

try:
validator.resolver.resolve(ref)
validator._validate_reference(ref=ref, instance=instance)
except:
yield ValidationError(
f"{instance!r} reference {ref!r} could not be resolved",
Expand Down
7 changes: 4 additions & 3 deletions openapi_schema_validator/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
from typing import Type

from jsonschema import _legacy_validators
from jsonschema import _utils
from jsonschema import _validators
from jsonschema.protocols import Validator
from jsonschema.validators import Draft202012Validator
from jsonschema.validators import create
from jsonschema.validators import extend
from jsonschema_specifications import REGISTRY as SPECIFICATIONS

from openapi_schema_validator import _format as oas_format
from openapi_schema_validator import _types as oas_types
from openapi_schema_validator import _validators as oas_validators
from openapi_schema_validator._types import oas31_type_checker

OAS30Validator = create(
meta_schema=_utils.load_schema("draft4"),
meta_schema=SPECIFICATIONS.contents(
"http://json-schema.org/draft-04/schema#",
),
validators={
"multipleOf": _validators.multipleOf,
# exclusiveMaximum supported inside maximum_draft3_draft4
Expand Down
114 changes: 71 additions & 43 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ strict = true
module = "jsonschema.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "jsonschema_specifications"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "rfc3339_validator"
ignore_missing_imports = true
Expand Down Expand Up @@ -51,8 +55,9 @@ include = [

[tool.poetry.dependencies]
python = "^3.8.0"
jsonschema = ">=4.0.0,<4.18.0"
jsonschema = {version = "^4.18.0a1", allow-prereleases = true}
rfc3339-validator = "*" # requred by jsonschema for date-time checker
jsonschema-specifications = "^2023.5.2"

[tool.poetry.extras]
docs = ["sphinx", "sphinx-immaterial"]
Expand Down