diff --git a/poetry.lock b/poetry.lock index 0957b5d..e1d941a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2082,4 +2082,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "03702eb8885408995751cfe948b8e0e81cc9bb65684bf07789c146e611868267" +content-hash = "1ed918925e93beeca3fef48ab0d2d82941ae5ae6a0a166d2df8d262e51186f9f" diff --git a/pyproject.toml b/pyproject.toml index a366d77..d812f5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ exclude = ["pyramid_openapi3/tests/"] python = "^3.8" openapi-core = ">=0.19.0" +jsonschema-path = ">=0.3.0" pyramid = ">=1.10.7" diff --git a/pyramid_openapi3/__init__.py b/pyramid_openapi3/__init__.py index 8909adb..2d58b2b 100644 --- a/pyramid_openapi3/__init__.py +++ b/pyramid_openapi3/__init__.py @@ -5,7 +5,7 @@ from .exceptions import RequestValidationError from .exceptions import ResponseValidationError from .wrappers import PyramidOpenAPIRequest -from openapi_core import Spec +from jsonschema_path import SchemaPath from openapi_core.unmarshalling.request import V30RequestUnmarshaller from openapi_core.unmarshalling.response import V30ResponseUnmarshaller from openapi_core.validation.request.exceptions import SecurityValidationError @@ -235,7 +235,7 @@ def register() -> None: spec_dict, _ = read_from_filename(filepath) validate(spec_dict) - spec = Spec.from_dict(spec_dict) + spec = SchemaPath.from_dict(spec_dict) def spec_view(request: Request) -> FileResponse: return FileResponse(filepath, request=request, content_type="text/yaml") @@ -287,7 +287,7 @@ def register() -> None: spec_dict, _ = read_from_filename(str(path)) spec_url = path.as_uri() validate(spec_dict, base_uri=spec_url) - spec = Spec.from_dict(spec_dict, base_uri=spec_url) + spec = SchemaPath.from_dict(spec_dict, base_uri=spec_url) config.add_static_view(route, str(path.parent), permission=permission) config.add_route(route_name, f"{route}/{path.name}") @@ -303,7 +303,7 @@ def register() -> None: def _create_api_settings( - config: Configurator, filepath: str, route_name: str, spec: Spec + config: Configurator, filepath: str, route_name: str, spec: SchemaPath ) -> t.Dict: custom_formatters = config.registry.settings.get("pyramid_openapi3_formatters") custom_deserializers = config.registry.settings.get( @@ -438,7 +438,7 @@ def remove_prefixes(path: str) -> str: settings["pyramid_openapi3"]["routes"][route_name] = name -def _get_server_prefixes(spec: Spec) -> t.List[str]: +def _get_server_prefixes(spec: SchemaPath) -> t.List[str]: """Build a set of possible route prefixes from the api spec. Api routes may optionally be prefixed using servers (e.g: `/api/v1`).