jentic-openapi-datamodels 1.0.0a21__tar.gz → 1.0.0a23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/PKG-INFO +1 -1
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/pyproject.toml +1 -1
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/fields.py +18 -6
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/callback.py +4 -3
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/paths.py +2 -1
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/responses.py +2 -2
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/security_requirement.py +7 -9
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/callback.py +4 -3
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/paths.py +2 -1
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/responses.py +2 -2
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/security_requirement.py +7 -9
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/LICENSE +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/NOTICE +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/README.md +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/__init__.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/context.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/extractors.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/py.typed +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/sources.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/__init__.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/builders/__init__.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/components.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/contact.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/discriminator.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/encoding.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/example.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/external_documentation.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/header.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/info.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/license.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/link.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/media_type.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/oauth_flow.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/oauth_flows.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/openapi.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/operation.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/parameter.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/path_item.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/reference.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/request_body.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/response.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/schema.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/security_scheme.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/server.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/server_variable.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/tag.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v30/xml.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/__init__.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/builders/__init__.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/components.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/contact.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/discriminator.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/encoding.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/example.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/external_documentation.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/header.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/info.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/license.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/link.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/media_type.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/oauth_flow.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/oauth_flows.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/openapi.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/operation.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/parameter.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/path_item.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/reference.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/request_body.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/response.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/schema.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/security_scheme.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/server.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/server_variable.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/tag.py +0 -0
- {jentic_openapi_datamodels-1.0.0a21 → jentic_openapi_datamodels-1.0.0a23}/src/jentic/apitools/openapi/datamodels/low/v31/xml.py +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
from dataclasses import field, fields
|
|
1
|
+
from dataclasses import MISSING, field, fields
|
|
2
|
+
from typing import Any
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
__all__ = ["fixed_field", "fixed_fields", "patterned_field", "patterned_fields"]
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
def fixed_field(default=None, metadata=None):
|
|
8
|
+
def fixed_field(*, default: Any = None, metadata: dict[str, Any] | None = None) -> Any:
|
|
8
9
|
"""Mark a field as a fixed OpenAPI specification field."""
|
|
9
10
|
return field(default=default, metadata={**(metadata or {}), "fixed_field": True})
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
def fixed_fields(dataclass_type):
|
|
13
|
+
def fixed_fields(dataclass_type: type) -> dict[str, Any]:
|
|
13
14
|
"""
|
|
14
15
|
Get all fixed specification fields from a dataclass.
|
|
15
16
|
|
|
@@ -22,17 +23,28 @@ def fixed_fields(dataclass_type):
|
|
|
22
23
|
return {f.name: f for f in fields(dataclass_type) if f.metadata.get("fixed_field")}
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
def patterned_field(
|
|
26
|
+
def patterned_field(
|
|
27
|
+
*, default=MISSING, default_factory=MISSING, metadata: dict[str, Any] | None = None
|
|
28
|
+
) -> Any:
|
|
26
29
|
"""
|
|
27
30
|
Mark a field as containing OpenAPI patterned fields.
|
|
28
31
|
|
|
29
32
|
Patterned fields have dynamic names that follow a specific pattern (e.g., security scheme names,
|
|
30
33
|
path patterns, callback expressions, HTTP status codes).
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
default: Default value for the field
|
|
37
|
+
default_factory: Callable that returns default value
|
|
38
|
+
metadata: Additional metadata for the field
|
|
31
39
|
"""
|
|
32
|
-
|
|
40
|
+
merged_metadata = {**(metadata or {}), "patterned_field": True}
|
|
41
|
+
if default_factory is not MISSING:
|
|
42
|
+
return field(default_factory=default_factory, metadata=merged_metadata)
|
|
43
|
+
else:
|
|
44
|
+
return field(default=default, metadata=merged_metadata)
|
|
33
45
|
|
|
34
46
|
|
|
35
|
-
def patterned_fields(dataclass_type):
|
|
47
|
+
def patterned_fields(dataclass_type: type) -> dict[str, Any]:
|
|
36
48
|
"""
|
|
37
49
|
Get all patterned fields from a dataclass.
|
|
38
50
|
|
|
@@ -4,6 +4,7 @@ from ruamel import yaml
|
|
|
4
4
|
|
|
5
5
|
from ..context import Context
|
|
6
6
|
from ..extractors import extract_extension_fields
|
|
7
|
+
from ..fields import patterned_field
|
|
7
8
|
from ..sources import KeySource, ValueSource, YAMLInvalidValue, YAMLValue
|
|
8
9
|
from .path_item import PathItem
|
|
9
10
|
from .path_item import build as build_path_item
|
|
@@ -33,7 +34,7 @@ class Callback:
|
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
36
|
root_node: yaml.Node
|
|
36
|
-
path_items: dict[KeySource[str], PathItem] =
|
|
37
|
+
path_items: dict[KeySource[str], PathItem] = patterned_field(default_factory=dict)
|
|
37
38
|
extensions: dict[KeySource[str], ValueSource[YAMLValue]] = field(default_factory=dict)
|
|
38
39
|
|
|
39
40
|
|
|
@@ -86,7 +87,7 @@ def build(
|
|
|
86
87
|
extension_properties = {k.value for k in extensions.keys()}
|
|
87
88
|
|
|
88
89
|
# Process each field to determine if it's an expression (not an extension)
|
|
89
|
-
path_items
|
|
90
|
+
path_items = {}
|
|
90
91
|
|
|
91
92
|
for key_node, value_node in root.value:
|
|
92
93
|
expression = context.yaml_constructor.construct_yaml_str(key_node)
|
|
@@ -99,7 +100,7 @@ def build(
|
|
|
99
100
|
# Create and return the Callback object with collected data
|
|
100
101
|
return Callback(
|
|
101
102
|
root_node=root,
|
|
102
|
-
path_items=path_items,
|
|
103
|
+
path_items=path_items,
|
|
103
104
|
extensions=extensions,
|
|
104
105
|
)
|
|
105
106
|
|
|
@@ -4,6 +4,7 @@ from ruamel import yaml
|
|
|
4
4
|
|
|
5
5
|
from ..context import Context
|
|
6
6
|
from ..extractors import extract_extension_fields
|
|
7
|
+
from ..fields import patterned_field
|
|
7
8
|
from ..sources import KeySource, ValueSource, YAMLInvalidValue, YAMLValue
|
|
8
9
|
from .path_item import PathItem
|
|
9
10
|
from .path_item import build as build_path_item
|
|
@@ -33,7 +34,7 @@ class Paths:
|
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
36
|
root_node: yaml.Node
|
|
36
|
-
paths: dict[KeySource[str], PathItem] =
|
|
37
|
+
paths: dict[KeySource[str], PathItem] = patterned_field(default_factory=dict)
|
|
37
38
|
extensions: dict[KeySource[str], ValueSource[YAMLValue]] = field(default_factory=dict)
|
|
38
39
|
|
|
39
40
|
|
|
@@ -6,7 +6,7 @@ from ruamel import yaml
|
|
|
6
6
|
|
|
7
7
|
from ..context import Context
|
|
8
8
|
from ..extractors import extract_extension_fields
|
|
9
|
-
from ..fields import fixed_field
|
|
9
|
+
from ..fields import fixed_field, patterned_field
|
|
10
10
|
from ..sources import FieldSource, KeySource, ValueSource, YAMLInvalidValue, YAMLValue
|
|
11
11
|
from .reference import Reference
|
|
12
12
|
from .response import Response, build_response_or_reference
|
|
@@ -34,7 +34,7 @@ class Responses:
|
|
|
34
34
|
|
|
35
35
|
root_node: yaml.Node
|
|
36
36
|
default: FieldSource[Response | Reference] | None = fixed_field()
|
|
37
|
-
responses: dict[KeySource[str], Response | Reference] =
|
|
37
|
+
responses: dict[KeySource[str], Response | Reference] = patterned_field(default_factory=dict)
|
|
38
38
|
extensions: dict[KeySource[str], ValueSource[YAMLValue]] = field(default_factory=dict)
|
|
39
39
|
|
|
40
40
|
|
|
@@ -33,8 +33,8 @@ class SecurityRequirement:
|
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
35
|
root_node: yaml.Node
|
|
36
|
-
requirements:
|
|
37
|
-
|
|
36
|
+
requirements: dict[KeySource[str], ValueSource[list[ValueSource[str]]]] = patterned_field(
|
|
37
|
+
default_factory=dict
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
|
|
@@ -61,7 +61,7 @@ def build(
|
|
|
61
61
|
yaml = YAML()
|
|
62
62
|
root = yaml.compose("api_key: []")
|
|
63
63
|
security_req = build(root)
|
|
64
|
-
assert security_req.requirements
|
|
64
|
+
assert len(security_req.requirements) > 0
|
|
65
65
|
"""
|
|
66
66
|
context = context or Context()
|
|
67
67
|
|
|
@@ -70,7 +70,7 @@ def build(
|
|
|
70
70
|
value = context.yaml_constructor.construct_object(root, deep=True)
|
|
71
71
|
return ValueSource(value=value, value_node=root)
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
requirements = {}
|
|
74
74
|
|
|
75
75
|
for key_node, value_node in root.value:
|
|
76
76
|
key = context.yaml_constructor.construct_yaml_str(key_node)
|
|
@@ -88,19 +88,17 @@ def build(
|
|
|
88
88
|
item_value = context.yaml_constructor.construct_object(item_node, deep=True)
|
|
89
89
|
scope_list.append(ValueSource(value=item_value, value_node=item_node))
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
requirements[KeySource(value=key, key_node=key_node)] = ValueSource(
|
|
92
92
|
value=scope_list, value_node=value_node
|
|
93
93
|
)
|
|
94
94
|
else:
|
|
95
95
|
# Not a sequence - preserve as-is for validation to catch
|
|
96
96
|
value = context.yaml_constructor.construct_object(value_node, deep=True)
|
|
97
|
-
|
|
97
|
+
requirements[KeySource(value=key, key_node=key_node)] = ValueSource(
|
|
98
98
|
value=value, value_node=value_node
|
|
99
99
|
)
|
|
100
100
|
|
|
101
101
|
return SecurityRequirement(
|
|
102
102
|
root_node=root,
|
|
103
|
-
requirements=
|
|
104
|
-
ValueSource(value=requirements_dict, value_node=root) if requirements_dict else None
|
|
105
|
-
),
|
|
103
|
+
requirements=requirements,
|
|
106
104
|
)
|
|
@@ -4,6 +4,7 @@ from ruamel import yaml
|
|
|
4
4
|
|
|
5
5
|
from ..context import Context
|
|
6
6
|
from ..extractors import extract_extension_fields
|
|
7
|
+
from ..fields import patterned_field
|
|
7
8
|
from ..sources import KeySource, ValueSource, YAMLInvalidValue, YAMLValue
|
|
8
9
|
from .path_item import PathItem
|
|
9
10
|
from .path_item import build as build_path_item
|
|
@@ -33,7 +34,7 @@ class Callback:
|
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
36
|
root_node: yaml.Node
|
|
36
|
-
path_items: dict[KeySource[str], PathItem] =
|
|
37
|
+
path_items: dict[KeySource[str], PathItem] = patterned_field(default_factory=dict)
|
|
37
38
|
extensions: dict[KeySource[str], ValueSource[YAMLValue]] = field(default_factory=dict)
|
|
38
39
|
|
|
39
40
|
|
|
@@ -86,7 +87,7 @@ def build(
|
|
|
86
87
|
extension_properties = {k.value for k in extensions.keys()}
|
|
87
88
|
|
|
88
89
|
# Process each field to determine if it's an expression (not an extension)
|
|
89
|
-
path_items
|
|
90
|
+
path_items = {}
|
|
90
91
|
|
|
91
92
|
for key_node, value_node in root.value:
|
|
92
93
|
expression = context.yaml_constructor.construct_yaml_str(key_node)
|
|
@@ -99,7 +100,7 @@ def build(
|
|
|
99
100
|
# Create and return the Callback object with collected data
|
|
100
101
|
return Callback(
|
|
101
102
|
root_node=root,
|
|
102
|
-
path_items=path_items,
|
|
103
|
+
path_items=path_items,
|
|
103
104
|
extensions=extensions,
|
|
104
105
|
)
|
|
105
106
|
|
|
@@ -4,6 +4,7 @@ from ruamel import yaml
|
|
|
4
4
|
|
|
5
5
|
from ..context import Context
|
|
6
6
|
from ..extractors import extract_extension_fields
|
|
7
|
+
from ..fields import patterned_field
|
|
7
8
|
from ..sources import KeySource, ValueSource, YAMLInvalidValue, YAMLValue
|
|
8
9
|
from .path_item import PathItem
|
|
9
10
|
from .path_item import build as build_path_item
|
|
@@ -33,7 +34,7 @@ class Paths:
|
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
36
|
root_node: yaml.Node
|
|
36
|
-
paths: dict[KeySource[str], PathItem] =
|
|
37
|
+
paths: dict[KeySource[str], PathItem] = patterned_field(default_factory=dict)
|
|
37
38
|
extensions: dict[KeySource[str], ValueSource[YAMLValue]] = field(default_factory=dict)
|
|
38
39
|
|
|
39
40
|
|
|
@@ -6,7 +6,7 @@ from ruamel import yaml
|
|
|
6
6
|
|
|
7
7
|
from ..context import Context
|
|
8
8
|
from ..extractors import extract_extension_fields
|
|
9
|
-
from ..fields import fixed_field
|
|
9
|
+
from ..fields import fixed_field, patterned_field
|
|
10
10
|
from ..sources import FieldSource, KeySource, ValueSource, YAMLInvalidValue, YAMLValue
|
|
11
11
|
from .reference import Reference
|
|
12
12
|
from .response import Response, build_response_or_reference
|
|
@@ -34,7 +34,7 @@ class Responses:
|
|
|
34
34
|
|
|
35
35
|
root_node: yaml.Node
|
|
36
36
|
default: FieldSource[Response | Reference] | None = fixed_field()
|
|
37
|
-
responses: dict[KeySource[str], Response | Reference] =
|
|
37
|
+
responses: dict[KeySource[str], Response | Reference] = patterned_field(default_factory=dict)
|
|
38
38
|
extensions: dict[KeySource[str], ValueSource[YAMLValue]] = field(default_factory=dict)
|
|
39
39
|
|
|
40
40
|
|
|
@@ -33,8 +33,8 @@ class SecurityRequirement:
|
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
35
|
root_node: yaml.Node
|
|
36
|
-
requirements:
|
|
37
|
-
|
|
36
|
+
requirements: dict[KeySource[str], ValueSource[list[ValueSource[str]]]] = patterned_field(
|
|
37
|
+
default_factory=dict
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
|
|
@@ -61,7 +61,7 @@ def build(
|
|
|
61
61
|
yaml = YAML()
|
|
62
62
|
root = yaml.compose("api_key: []")
|
|
63
63
|
security_req = build(root)
|
|
64
|
-
assert security_req.requirements
|
|
64
|
+
assert len(security_req.requirements) > 0
|
|
65
65
|
"""
|
|
66
66
|
context = context or Context()
|
|
67
67
|
|
|
@@ -70,7 +70,7 @@ def build(
|
|
|
70
70
|
value = context.yaml_constructor.construct_object(root, deep=True)
|
|
71
71
|
return ValueSource(value=value, value_node=root)
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
requirements = {}
|
|
74
74
|
|
|
75
75
|
for key_node, value_node in root.value:
|
|
76
76
|
key = context.yaml_constructor.construct_yaml_str(key_node)
|
|
@@ -88,19 +88,17 @@ def build(
|
|
|
88
88
|
item_value = context.yaml_constructor.construct_object(item_node, deep=True)
|
|
89
89
|
scope_list.append(ValueSource(value=item_value, value_node=item_node))
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
requirements[KeySource(value=key, key_node=key_node)] = ValueSource(
|
|
92
92
|
value=scope_list, value_node=value_node
|
|
93
93
|
)
|
|
94
94
|
else:
|
|
95
95
|
# Not a sequence - preserve as-is for validation to catch
|
|
96
96
|
value = context.yaml_constructor.construct_object(value_node, deep=True)
|
|
97
|
-
|
|
97
|
+
requirements[KeySource(value=key, key_node=key_node)] = ValueSource(
|
|
98
98
|
value=value, value_node=value_node
|
|
99
99
|
)
|
|
100
100
|
|
|
101
101
|
return SecurityRequirement(
|
|
102
102
|
root_node=root,
|
|
103
|
-
requirements=
|
|
104
|
-
ValueSource(value=requirements_dict, value_node=root) if requirements_dict else None
|
|
105
|
-
),
|
|
103
|
+
requirements=requirements,
|
|
106
104
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|