jentic-openapi-traverse 1.0.0a24__tar.gz → 1.0.0a25__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_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/PKG-INFO +2 -2
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/pyproject.toml +2 -2
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/datamodels/low/introspection.py +24 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/datamodels/low/path.py +6 -1
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/LICENSE +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/NOTICE +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/README.md +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/datamodels/low/__init__.py +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/datamodels/low/merge.py +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/datamodels/low/py.typed +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/datamodels/low/traversal.py +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/json/__init__.py +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/json/py.typed +0 -0
- {jentic_openapi_traverse-1.0.0a24 → jentic_openapi_traverse-1.0.0a25}/src/jentic/apitools/openapi/traverse/json/traversal.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jentic-openapi-traverse
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0a25
|
|
4
4
|
Summary: Jentic OpenAPI Traversal Utilities
|
|
5
5
|
Author: Jentic
|
|
6
6
|
Author-email: Jentic <hello@jentic.com>
|
|
7
7
|
License-Expression: Apache-2.0
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
License-File: NOTICE
|
|
10
|
-
Requires-Dist: jentic-openapi-datamodels~=1.0.
|
|
10
|
+
Requires-Dist: jentic-openapi-datamodels~=1.0.0a25
|
|
11
11
|
Requires-Dist: jsonpointer~=3.0.0
|
|
12
12
|
Requires-Python: >=3.11
|
|
13
13
|
Project-URL: Homepage, https://github.com/jentic/jentic-openapi-tools
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "jentic-openapi-traverse"
|
|
3
|
-
version = "1.0.0-alpha.
|
|
3
|
+
version = "1.0.0-alpha.25"
|
|
4
4
|
description = "Jentic OpenAPI Traversal Utilities"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Jentic", email = "hello@jentic.com" }]
|
|
@@ -8,7 +8,7 @@ license = "Apache-2.0"
|
|
|
8
8
|
license-files = ["LICENSE", "NOTICE"]
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [
|
|
11
|
-
"jentic-openapi-datamodels~=1.0.0-alpha.
|
|
11
|
+
"jentic-openapi-datamodels~=1.0.0-alpha.25",
|
|
12
12
|
"jsonpointer~=3.0.0"
|
|
13
13
|
]
|
|
14
14
|
|
|
@@ -15,9 +15,33 @@ __all__ = [
|
|
|
15
15
|
"get_traversable_fields",
|
|
16
16
|
"unwrap_value",
|
|
17
17
|
"is_datamodel_node",
|
|
18
|
+
"get_yaml_field_name",
|
|
18
19
|
]
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
def get_yaml_field_name(node_class: type, python_field_name: str) -> str:
|
|
23
|
+
"""
|
|
24
|
+
Convert Python field name to YAML field name using metadata.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
node_class: Datamodel class type
|
|
28
|
+
python_field_name: Python attribute name (e.g., "external_docs")
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
YAML field name from metadata, or python_field_name if not found
|
|
32
|
+
(e.g., "externalDocs")
|
|
33
|
+
"""
|
|
34
|
+
fixed = fixed_fields(node_class)
|
|
35
|
+
patterned = patterned_fields(node_class)
|
|
36
|
+
|
|
37
|
+
# Try fixed fields first, then patterned
|
|
38
|
+
field_obj = fixed.get(python_field_name) or patterned.get(python_field_name)
|
|
39
|
+
if field_obj:
|
|
40
|
+
return field_obj.metadata.get("yaml_name", python_field_name)
|
|
41
|
+
|
|
42
|
+
return python_field_name
|
|
43
|
+
|
|
44
|
+
|
|
21
45
|
# Cache of field names to check per class type
|
|
22
46
|
# {Info: ["title", "description", "contact", ...], Operation: [...], ...}
|
|
23
47
|
_FIELD_NAMES_CACHE: dict[type, list[str]] = {}
|
|
@@ -5,6 +5,8 @@ from typing import Any, Literal
|
|
|
5
5
|
|
|
6
6
|
from jsonpointer import JsonPointer
|
|
7
7
|
|
|
8
|
+
from .introspection import get_yaml_field_name
|
|
9
|
+
|
|
8
10
|
|
|
9
11
|
__all__ = ["NodePath"]
|
|
10
12
|
|
|
@@ -129,7 +131,10 @@ class NodePath:
|
|
|
129
131
|
if current.parent_key is not None:
|
|
130
132
|
segments.append(current.parent_key)
|
|
131
133
|
if current.parent_field:
|
|
132
|
-
|
|
134
|
+
# Convert Python field name to YAML name for output
|
|
135
|
+
parent_class = type(current.parent_path.node)
|
|
136
|
+
yaml_name = get_yaml_field_name(parent_class, current.parent_field)
|
|
137
|
+
segments.append(yaml_name)
|
|
133
138
|
current = current.parent_path
|
|
134
139
|
|
|
135
140
|
segments.reverse() # Root to leaf order
|
|
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
|