Skip to content

Commit 50c4ac8

Browse files
mikethemanzupo
authored andcommitted
refactor: replace deprecated Spec
Refs: python-openapi/openapi-core#690 Signed-off-by: Mike Fiedler <[email protected]>
1 parent 379324d commit 50c4ac8

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Diff for: poetry.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ exclude = ["pyramid_openapi3/tests/"]
2727
python = "^3.8"
2828

2929
openapi-core = ">=0.19.0"
30+
jsonschema-path = ">=0.3.0"
3031
pyramid = ">=1.10.7"
3132

3233

Diff for: pyramid_openapi3/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .exceptions import RequestValidationError
66
from .exceptions import ResponseValidationError
77
from .wrappers import PyramidOpenAPIRequest
8-
from openapi_core import Spec
8+
from jsonschema_path import SchemaPath
99
from openapi_core.unmarshalling.request import V30RequestUnmarshaller
1010
from openapi_core.unmarshalling.response import V30ResponseUnmarshaller
1111
from openapi_core.validation.request.exceptions import SecurityValidationError
@@ -235,7 +235,7 @@ def register() -> None:
235235
spec_dict, _ = read_from_filename(filepath)
236236

237237
validate(spec_dict)
238-
spec = Spec.from_dict(spec_dict)
238+
spec = SchemaPath.from_dict(spec_dict)
239239

240240
def spec_view(request: Request) -> FileResponse:
241241
return FileResponse(filepath, request=request, content_type="text/yaml")
@@ -287,7 +287,7 @@ def register() -> None:
287287
spec_dict, _ = read_from_filename(str(path))
288288
spec_url = path.as_uri()
289289
validate(spec_dict, base_uri=spec_url)
290-
spec = Spec.from_dict(spec_dict, base_uri=spec_url)
290+
spec = SchemaPath.from_dict(spec_dict, base_uri=spec_url)
291291

292292
config.add_static_view(route, str(path.parent), permission=permission)
293293
config.add_route(route_name, f"{route}/{path.name}")
@@ -303,7 +303,7 @@ def register() -> None:
303303

304304

305305
def _create_api_settings(
306-
config: Configurator, filepath: str, route_name: str, spec: Spec
306+
config: Configurator, filepath: str, route_name: str, spec: SchemaPath
307307
) -> t.Dict:
308308
custom_formatters = config.registry.settings.get("pyramid_openapi3_formatters")
309309
custom_deserializers = config.registry.settings.get(
@@ -438,7 +438,7 @@ def remove_prefixes(path: str) -> str:
438438
settings["pyramid_openapi3"]["routes"][route_name] = name
439439

440440

441-
def _get_server_prefixes(spec: Spec) -> t.List[str]:
441+
def _get_server_prefixes(spec: SchemaPath) -> t.List[str]:
442442
"""Build a set of possible route prefixes from the api spec.
443443
444444
Api routes may optionally be prefixed using servers (e.g: `/api/v1`).

0 commit comments

Comments
 (0)