|
7 | 7 | from typing import Type
|
8 | 8 | from typing import TypeVar
|
9 | 9 |
|
10 |
| -from jsonschema_spec import Spec as JsonschemaSpec |
| 10 | +from jsonschema_spec import SchemaPath |
11 | 11 | from jsonschema_spec import default_handlers
|
12 | 12 | from openapi_spec_validator.validation import openapi_spec_validator_proxy
|
13 | 13 | from openapi_spec_validator.validation.protocols import SupportsValidation
|
|
17 | 17 | SPEC_SEPARATOR = "#"
|
18 | 18 |
|
19 | 19 |
|
20 |
| -class Spec(JsonschemaSpec): |
| 20 | +class Spec(SchemaPath): |
21 | 21 | @classmethod
|
22 | 22 | def create(
|
23 | 23 | cls: Type[TSpec],
|
@@ -47,21 +47,15 @@ def from_dict(
|
47 | 47 | cls: Type[TSpec],
|
48 | 48 | data: Mapping[Hashable, Any],
|
49 | 49 | *args: Any,
|
50 |
| - spec_url: str = "", |
51 |
| - ref_resolver_handlers: Mapping[str, Any] = default_handlers, |
52 |
| - separator: str = SPEC_SEPARATOR, |
53 |
| - validator: Optional[SupportsValidation] = openapi_spec_validator_proxy, |
| 50 | + **kwargs: Any, |
54 | 51 | ) -> TSpec:
|
| 52 | + validator = kwargs.pop("validator", None) |
55 | 53 | if validator is not None:
|
56 |
| - validator.validate(data, spec_url=spec_url) |
| 54 | + base_uri = kwargs.get("base_uri") |
| 55 | + spec_url = kwargs.get("spec_url") |
| 56 | + validator.validate(data, base_uri=base_uri, spec_url=spec_url) |
57 | 57 |
|
58 |
| - return super().from_dict( |
59 |
| - data, |
60 |
| - *args, |
61 |
| - spec_url=spec_url, |
62 |
| - ref_resolver_handlers=ref_resolver_handlers, |
63 |
| - separator=separator, |
64 |
| - ) |
| 58 | + return super().from_dict(data, *args, **kwargs) |
65 | 59 |
|
66 | 60 | def exists(self) -> bool:
|
67 | 61 | try:
|
|
0 commit comments