python-openapi 0.1.10__py3-none-any.whl → 0.3.0__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.
- pyopenapi/__init__.py +11 -51
- pyopenapi/decorators.py +58 -0
- pyopenapi/generator.py +85 -75
- pyopenapi/metadata.py +14 -4
- pyopenapi/operations.py +48 -33
- pyopenapi/options.py +19 -12
- pyopenapi/proxy.py +20 -10
- pyopenapi/specification.py +89 -70
- pyopenapi/utility.py +12 -8
- {python_openapi-0.1.10.dist-info → python_openapi-0.3.0.dist-info}/METADATA +28 -17
- python_openapi-0.3.0.dist-info/RECORD +17 -0
- {python_openapi-0.1.10.dist-info → python_openapi-0.3.0.dist-info}/WHEEL +1 -1
- {python_openapi-0.1.10.dist-info → python_openapi-0.3.0.dist-info/licenses}/LICENSE +1 -1
- pyopenapi/__main__.py +0 -0
- python_openapi-0.1.10.dist-info/RECORD +0 -17
- {python_openapi-0.1.10.dist-info → python_openapi-0.3.0.dist-info}/top_level.txt +0 -0
- {python_openapi-0.1.10.dist-info → python_openapi-0.3.0.dist-info}/zip-safe +0 -0
|
@@ -1,30 +1,41 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-openapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Generate an OpenAPI specification from a Python class definition
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Levente Hunyadi <hunyadi@gmail.com>
|
|
6
|
+
Maintainer-email: Levente Hunyadi <hunyadi@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/hunyadi/pyopenapi
|
|
9
|
+
Project-URL: Source, https://github.com/hunyadi/pyopenapi
|
|
10
|
+
Keywords: openapi3,openapi,redoc,swagger,json-schema-generator,dataclasses,type-inspection
|
|
9
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
12
|
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
13
|
Classifier: Operating System :: OS Independent
|
|
13
14
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
21
|
Classifier: Topic :: Software Development :: Code Generators
|
|
21
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
23
|
Classifier: Typing :: Typed
|
|
23
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
24
25
|
Description-Content-Type: text/markdown
|
|
25
26
|
License-File: LICENSE
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
|
|
27
|
+
Requires-Dist: json_strong_typing>=0.4
|
|
28
|
+
Provides-Extra: proxy
|
|
29
|
+
Requires-Dist: aiohttp>=3.13; extra == "proxy"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: build; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff; extra == "dev"
|
|
34
|
+
Requires-Dist: PyYAML; extra == "dev"
|
|
35
|
+
Requires-Dist: Pygments; extra == "dev"
|
|
36
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
37
|
+
Requires-Dist: types-Pygments; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
28
39
|
|
|
29
40
|
# Generate an OpenAPI specification from a Python class
|
|
30
41
|
|
|
@@ -35,7 +46,7 @@ Requires-Dist: json-strong-typing>=0.3.7
|
|
|
35
46
|
* supports standard and asynchronous functions (`async def`)
|
|
36
47
|
* maps function name prefixes such as `get_` or `create_` to HTTP GET, POST, PUT, DELETE, PATCH
|
|
37
48
|
* handles both simple and composite types (`int`, `str`, `Enum`, `@dataclass`)
|
|
38
|
-
* handles generic types (`
|
|
49
|
+
* handles generic types (`list[T]`, `dict[K, V]`, `T | None`, `T1 | T2 | T3`)
|
|
39
50
|
* maps Python positional-only and keyword-only arguments (of simple types) to path and query parameters, respectively
|
|
40
51
|
* maps composite types to HTTP request body
|
|
41
52
|
* supports user-defined routes, request and response samples with decorator `@webmethod`
|
|
@@ -88,7 +99,7 @@ Let's take a look at the definition of a simple endpoint called `JobManagement`:
|
|
|
88
99
|
|
|
89
100
|
```python
|
|
90
101
|
class JobManagement:
|
|
91
|
-
def create_job(self, items:
|
|
102
|
+
def create_job(self, items: list[URL]) -> uuid.UUID:
|
|
92
103
|
...
|
|
93
104
|
|
|
94
105
|
def get_job(self, job_id: uuid.UUID, /, format: Format) -> Job:
|
|
@@ -127,7 +138,7 @@ The custom path must have placeholders for all positional-only parameters in the
|
|
|
127
138
|
|
|
128
139
|
### Documenting operations
|
|
129
140
|
|
|
130
|
-
Use Python ReST (ReStructured Text) doc-strings to attach documentation to operations:
|
|
141
|
+
Use Python ReST (ReStructured Text) doc-strings to attach documentation to operations:
|
|
131
142
|
|
|
132
143
|
```python
|
|
133
144
|
def get_job(self, job_id: uuid.UUID, /, format: Format) -> Job:
|
|
@@ -160,7 +171,7 @@ OpenAPI supports specifying [examples](https://spec.openapis.org/oas/latest.html
|
|
|
160
171
|
Teacher("Vacska", "Mati", "Négyszögletű Kerek Erdő"),
|
|
161
172
|
],
|
|
162
173
|
)
|
|
163
|
-
def get_member_by_name(self, family: str, given: str, /) ->
|
|
174
|
+
def get_member_by_name(self, family: str, given: str, /) -> Student | Teacher:
|
|
164
175
|
...
|
|
165
176
|
```
|
|
166
177
|
|
|
@@ -170,7 +181,7 @@ The Python objects in `request_examples` and `response_examples` are translated
|
|
|
170
181
|
|
|
171
182
|
### Mapping function name prefixes to HTTP verbs
|
|
172
183
|
|
|
173
|
-
The following table identifies which function name prefixes map to which HTTP verbs:
|
|
184
|
+
The following table identifies which function name prefixes map to which HTTP verbs:
|
|
174
185
|
|
|
175
186
|
| Prefix | HTTP verb |
|
|
176
187
|
| ------ | ----------- |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
pyopenapi/__init__.py,sha256=sxWWrvwYCPei47qPd9-muDYIzB0oXD-unVnWKzaGO90,345
|
|
2
|
+
pyopenapi/decorators.py,sha256=8IbLDy4kiawRIdmBRHm0soayEwCFfIntm_bjQFMb_X4,2163
|
|
3
|
+
pyopenapi/generator.py,sha256=jA6H2CNYdaslXH8lU_1RLWcalpHnBwVCdn0_Zc_C2IE,23977
|
|
4
|
+
pyopenapi/metadata.py,sha256=xZVAYYkmlkrf19qYcS5S1nlWbx86oHGFidmY4o5nlEA,1008
|
|
5
|
+
pyopenapi/operations.py,sha256=IOPzmeq_3O_qNowK-H3XBbTpYpKDTZ2ZRK5cgLuA-1Y,13905
|
|
6
|
+
pyopenapi/options.py,sha256=4IzdhNJX5FzY9wRA7qn0h8jEwj0THPTe7VoLXzHOGHE,2949
|
|
7
|
+
pyopenapi/proxy.py,sha256=tpm2xLb98Txa3rjBRWcOD95opDjbk_slusG5nAhlpOg,4347
|
|
8
|
+
pyopenapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
pyopenapi/specification.py,sha256=0QS2Us0GJy5lvn5iZp02JhCQ0oHDjHj7SOrmpndNjW8,6812
|
|
10
|
+
pyopenapi/template.html,sha256=hmZsSnN3awQcwlN6u-j06qrw_qYzWqYBLC8uPt_x17A,1234
|
|
11
|
+
pyopenapi/utility.py,sha256=HPCcbHDPPEdzCHzNOfkN2jTy-5gurldSXyklzOIynI4,3553
|
|
12
|
+
python_openapi-0.3.0.dist-info/licenses/LICENSE,sha256=6I1hyDmy1G8jhCaey2Ywf2YyBaoseABzfpJPcS7OP4w,1118
|
|
13
|
+
python_openapi-0.3.0.dist-info/METADATA,sha256=VomRnf0hVhWfL6zoRy1yRho6W_-0CRIVfT9wsb-Ocgs,10822
|
|
14
|
+
python_openapi-0.3.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
|
15
|
+
python_openapi-0.3.0.dist-info/top_level.txt,sha256=3M9FA79QfjyZyTipZP5fDiMcrRdcbSl7lW-iaq5RIRQ,10
|
|
16
|
+
python_openapi-0.3.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
17
|
+
python_openapi-0.3.0.dist-info/RECORD,,
|
pyopenapi/__main__.py
DELETED
|
File without changes
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
pyopenapi/__init__.py,sha256=4HS5YmQwTzehGw1lUPkZmlKqnL05kAx7aKRq3Q1Lt_4,2020
|
|
2
|
-
pyopenapi/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
pyopenapi/generator.py,sha256=DVR4n06TmSghR14_9tLPX6yCX1_Arfbh2pU7UvBD7C8,23807
|
|
4
|
-
pyopenapi/metadata.py,sha256=RnAfH79SJVE7-3HWJmdXAm_Kc5L5-4gutyh6xOZc8Fs,766
|
|
5
|
-
pyopenapi/operations.py,sha256=b2wiW93chm9b3pOOXrk4wip1DdjLsB7tgzszyBg2RcU,13318
|
|
6
|
-
pyopenapi/options.py,sha256=uc-nnyGJeaI3qHWvtDzDz-JBInhETEySF-SplyOr9_w,2795
|
|
7
|
-
pyopenapi/proxy.py,sha256=xEO541yqA6ed8jCq01b339_JW1pDSrMN_vxKYk_ZhBg,4096
|
|
8
|
-
pyopenapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
pyopenapi/specification.py,sha256=qr9K9DyDIW6B-MkrAS26_op1Qj3eosNyD92XimtLRn4,5974
|
|
10
|
-
pyopenapi/template.html,sha256=hmZsSnN3awQcwlN6u-j06qrw_qYzWqYBLC8uPt_x17A,1234
|
|
11
|
-
pyopenapi/utility.py,sha256=ZLe1Ss0MGBRD7fL0uSu7nWqUlMIIfAK2supDbN5-uCU,3625
|
|
12
|
-
python_openapi-0.1.10.dist-info/LICENSE,sha256=sNQ9jvMoMB8FfhB7JbkJYLr8SWSO6jrYvcS-mRL485w,1118
|
|
13
|
-
python_openapi-0.1.10.dist-info/METADATA,sha256=_g7APIZO9ZbYMkYghCx0RoRzlIzhkWt2CU1KD5Gmcr8,10305
|
|
14
|
-
python_openapi-0.1.10.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
15
|
-
python_openapi-0.1.10.dist-info/top_level.txt,sha256=3M9FA79QfjyZyTipZP5fDiMcrRdcbSl7lW-iaq5RIRQ,10
|
|
16
|
-
python_openapi-0.1.10.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
17
|
-
python_openapi-0.1.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|