jentic-openapi-datamodels 1.0.0a20__py3-none-any.whl → 1.0.0a21__py3-none-any.whl
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.0a20.dist-info → jentic_openapi_datamodels-1.0.0a21.dist-info}/METADATA +59 -4
- {jentic_openapi_datamodels-1.0.0a20.dist-info → jentic_openapi_datamodels-1.0.0a21.dist-info}/RECORD +5 -5
- {jentic_openapi_datamodels-1.0.0a20.dist-info → jentic_openapi_datamodels-1.0.0a21.dist-info}/WHEEL +0 -0
- {jentic_openapi_datamodels-1.0.0a20.dist-info → jentic_openapi_datamodels-1.0.0a21.dist-info}/licenses/LICENSE +0 -0
- {jentic_openapi_datamodels-1.0.0a20.dist-info → jentic_openapi_datamodels-1.0.0a21.dist-info}/licenses/NOTICE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jentic-openapi-datamodels
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0a21
|
|
4
4
|
Summary: Jentic OpenAPI Data Models
|
|
5
5
|
Author: Jentic
|
|
6
6
|
Author-email: Jentic <hello@jentic.com>
|
|
@@ -61,9 +61,64 @@ pip install jentic-openapi-datamodels
|
|
|
61
61
|
|
|
62
62
|
## Quick Start
|
|
63
63
|
|
|
64
|
-
### Parsing
|
|
64
|
+
### Parsing with the `datamodel-low` Parser Backend (Recommended)
|
|
65
65
|
|
|
66
|
-
The
|
|
66
|
+
The easiest way to parse OpenAPI documents into datamodels is using the `datamodel-low` backend from `jentic-openapi-parser`. This backend automatically detects the OpenAPI version and returns the appropriate typed datamodel:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from jentic.apitools.openapi.parser.core import OpenAPIParser
|
|
70
|
+
from jentic.apitools.openapi.parser.backends.datamodel_low import DataModelLow
|
|
71
|
+
from jentic.apitools.openapi.datamodels.low.v30.openapi import OpenAPI30
|
|
72
|
+
from jentic.apitools.openapi.datamodels.low.v31.openapi import OpenAPI31
|
|
73
|
+
|
|
74
|
+
# Create parser with datamodel-low backend
|
|
75
|
+
parser = OpenAPIParser("datamodel-low")
|
|
76
|
+
|
|
77
|
+
# Parse OpenAPI 3.0 document - automatically returns OpenAPI30
|
|
78
|
+
doc = parser.parse("""
|
|
79
|
+
openapi: 3.0.4
|
|
80
|
+
info:
|
|
81
|
+
title: Pet Store API
|
|
82
|
+
version: 1.0.0
|
|
83
|
+
paths:
|
|
84
|
+
/pets:
|
|
85
|
+
get:
|
|
86
|
+
summary: List all pets
|
|
87
|
+
responses:
|
|
88
|
+
'200':
|
|
89
|
+
description: A list of pets
|
|
90
|
+
""", return_type=DataModelLow)
|
|
91
|
+
|
|
92
|
+
assert isinstance(doc, OpenAPI30)
|
|
93
|
+
print(doc.openapi.value) # "3.0.4"
|
|
94
|
+
print(doc.info.value.title.value) # "Pet Store API"
|
|
95
|
+
|
|
96
|
+
# Parse OpenAPI 3.1 document - automatically returns OpenAPI31
|
|
97
|
+
doc = parser.parse("""
|
|
98
|
+
openapi: 3.1.2
|
|
99
|
+
info:
|
|
100
|
+
title: Pet Store API
|
|
101
|
+
version: 1.0.0
|
|
102
|
+
paths: {}
|
|
103
|
+
""", return_type=DataModelLow)
|
|
104
|
+
|
|
105
|
+
assert isinstance(doc, OpenAPI31)
|
|
106
|
+
print(doc.openapi.value) # "3.1.2"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Benefits of `datamodel-low` backend:**
|
|
110
|
+
- Automatic version detection (no manual version checking)
|
|
111
|
+
- Returns strongly-typed `OpenAPI30` or `OpenAPI31` objects
|
|
112
|
+
- Complete source tracking preserved
|
|
113
|
+
- Single-step parsing (no need to manually call `build()`)
|
|
114
|
+
|
|
115
|
+
### Manual Parsing with Builder Functions
|
|
116
|
+
|
|
117
|
+
For advanced use cases or custom workflows, you can manually parse and build datamodels:
|
|
118
|
+
|
|
119
|
+
#### Parsing OpenAPI 3.0 Documents
|
|
120
|
+
|
|
121
|
+
The manual approach uses the `ruamel-ast` backend followed by calling the builder function:
|
|
67
122
|
|
|
68
123
|
```python
|
|
69
124
|
from jentic.apitools.openapi.parser.core import OpenAPIParser
|
|
@@ -102,7 +157,7 @@ for path_key, path_item in openapi_doc.paths.value.path_items.items():
|
|
|
102
157
|
print(f" Summary: {operation.summary.value}") # "List all pets"
|
|
103
158
|
```
|
|
104
159
|
|
|
105
|
-
|
|
160
|
+
#### Parsing OpenAPI 3.1 Documents with JSON Schema 2020-12
|
|
106
161
|
|
|
107
162
|
OpenAPI 3.1 fully supports JSON Schema 2020-12, including advanced features like boolean schemas, conditional validation and vocabulary declarations:
|
|
108
163
|
|
{jentic_openapi_datamodels-1.0.0a20.dist-info → jentic_openapi_datamodels-1.0.0a21.dist-info}/RECORD
RENAMED
|
@@ -68,8 +68,8 @@ jentic/apitools/openapi/datamodels/low/v31/server.py,sha256=IA-dDnhqdD6WCZ_bjdGw
|
|
|
68
68
|
jentic/apitools/openapi/datamodels/low/v31/server_variable.py,sha256=UfGDky_NVUF_WQc5ZIU947MjmpxaO__VIv6sq8HMsk0,2762
|
|
69
69
|
jentic/apitools/openapi/datamodels/low/v31/tag.py,sha256=8-QfVk4dUp3r-LbseMSvlCcAWeZkzlhZP3giVKNgaPI,2359
|
|
70
70
|
jentic/apitools/openapi/datamodels/low/v31/xml.py,sha256=SFLNLrhiZRWVH_CBV8SqtO4C4qjDjGtqz_lYpp84BnE,1930
|
|
71
|
-
jentic_openapi_datamodels-1.0.
|
|
72
|
-
jentic_openapi_datamodels-1.0.
|
|
73
|
-
jentic_openapi_datamodels-1.0.
|
|
74
|
-
jentic_openapi_datamodels-1.0.
|
|
75
|
-
jentic_openapi_datamodels-1.0.
|
|
71
|
+
jentic_openapi_datamodels-1.0.0a21.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
72
|
+
jentic_openapi_datamodels-1.0.0a21.dist-info/licenses/NOTICE,sha256=pAOGW-rGw9KNc2cuuLWZkfx0GSTV4TicbgBKZSLPMIs,168
|
|
73
|
+
jentic_openapi_datamodels-1.0.0a21.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
74
|
+
jentic_openapi_datamodels-1.0.0a21.dist-info/METADATA,sha256=DNCYjrFBmVPrNG-8RRf8IrC8yEkyGZeJRd6tF3JNv4Q,14260
|
|
75
|
+
jentic_openapi_datamodels-1.0.0a21.dist-info/RECORD,,
|
{jentic_openapi_datamodels-1.0.0a20.dist-info → jentic_openapi_datamodels-1.0.0a21.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|