openapi-python-client 0.21.6__tar.gz → 0.22.0__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.
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/PKG-INFO +4 -6
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/__init__.py +7 -6
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/cli.py +2 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/config.py +7 -7
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/bodies.py +5 -5
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/errors.py +1 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/openapi.py +31 -30
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/__init__.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/const.py +1 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/enum_property.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/list_property.py +4 -4
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/literal_enum_property.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/model_property.py +2 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/protocol.py +1 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/schemas.py +15 -15
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/responses.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/callback.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/components.py +10 -10
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/link.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/media_type.py +3 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +4 -4
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/operation.py +6 -6
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/parameter.py +3 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/path_item.py +3 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/paths.py +1 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/request_body.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/response.py +4 -4
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/responses.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/schema.py +9 -9
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py +1 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/server.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/client.py.jinja +6 -6
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/endpoint_macros.py.jinja +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/endpoint_module.py.jinja +3 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/literal_enum.py.jinja +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/model.py.jinja +7 -12
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/enum_property.py.jinja +1 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/list_property.py.jinja +1 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/literal_enum_property.py.jinja +1 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/pyproject.toml.jinja +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/setup.py.jinja +1 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/types.py.jinja +5 -3
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/utils.py +0 -1
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/pyproject.toml +4 -5
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/.gitignore +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/LICENSE +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/README.md +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/__main__.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/__init__.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/any.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/boolean.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/date.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/datetime.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/file.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/float.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/int.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/merge_properties.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/none.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/property.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/string.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/union.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/properties/uuid.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/py.typed +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/3.0.3.md +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/3.1.0.md +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/__init__.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/data_type.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/LICENSE +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/README.md +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/__init__.py +2 -2
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/contact.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/example.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/header.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/info.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/license.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/reference.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/tag.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/openapi_schema_pydantic/xml.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/schema/parameter_location.py +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/.gitignore.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/README.md.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/api_init.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/endpoint_init.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/errors.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/helpers.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/int_enum.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/models_init.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/package_init.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/any_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/boolean_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/const_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/date_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/datetime_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/file_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/float_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/helpers.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/int_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/model_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/property_macros.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/union_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/property_templates/uuid_property.py.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/pyproject_ruff.toml.jinja +0 -0
- {openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/templates/str_enum.py.jinja +0 -0
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: openapi-python-client
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.0
|
|
4
4
|
Summary: Generate modern Python clients from OpenAPI
|
|
5
5
|
Project-URL: repository, https://github.com/openapi-generators/openapi-python-client
|
|
6
6
|
Author-email: Dylan Anthony <contact@dylananthony.com>
|
|
7
7
|
License: MIT
|
|
8
|
-
License-File: LICENSE
|
|
9
8
|
Keywords: Client,Generator,OpenAPI
|
|
10
9
|
Classifier: Development Status :: 4 - Beta
|
|
11
10
|
Classifier: Intended Audience :: Developers
|
|
12
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
12
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -19,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
18
|
Classifier: Topic :: Software Development :: Code Generators
|
|
21
19
|
Classifier: Typing :: Typed
|
|
22
|
-
Requires-Python: <4.0,>=3.
|
|
20
|
+
Requires-Python: <4.0,>=3.9
|
|
23
21
|
Requires-Dist: attrs>=21.3.0
|
|
24
22
|
Requires-Dist: colorama>=0.4.3; sys_platform == 'win32'
|
|
25
23
|
Requires-Dist: httpx<0.28.0,>=0.20.0
|
|
@@ -27,9 +25,9 @@ Requires-Dist: jinja2<4.0.0,>=3.0.0
|
|
|
27
25
|
Requires-Dist: pydantic<3.0.0,>=2.1.1
|
|
28
26
|
Requires-Dist: python-dateutil<3.0.0,>=2.8.1
|
|
29
27
|
Requires-Dist: ruamel-yaml<0.19.0,>=0.18.6
|
|
30
|
-
Requires-Dist: ruff<0.
|
|
28
|
+
Requires-Dist: ruff<0.9,>=0.2
|
|
31
29
|
Requires-Dist: shellingham<2.0.0,>=1.3.2
|
|
32
|
-
Requires-Dist: typer<0.
|
|
30
|
+
Requires-Dist: typer<0.14,>0.6
|
|
33
31
|
Requires-Dist: typing-extensions<5.0.0,>=4.8.0
|
|
34
32
|
Description-Content-Type: text/markdown
|
|
35
33
|
|
{openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/__init__.py
RENAMED
|
@@ -4,10 +4,11 @@ import json
|
|
|
4
4
|
import mimetypes
|
|
5
5
|
import shutil
|
|
6
6
|
import subprocess
|
|
7
|
+
from collections.abc import Sequence
|
|
7
8
|
from importlib.metadata import version
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
from subprocess import CalledProcessError
|
|
10
|
-
from typing import Any,
|
|
11
|
+
from typing import Any, Optional, Union
|
|
11
12
|
|
|
12
13
|
import httpcore
|
|
13
14
|
import httpx
|
|
@@ -101,7 +102,7 @@ class Project:
|
|
|
101
102
|
openapi=self.openapi,
|
|
102
103
|
endpoint_collections_by_tag=self.openapi.endpoint_collections_by_tag,
|
|
103
104
|
)
|
|
104
|
-
self.errors:
|
|
105
|
+
self.errors: list[GeneratorError] = []
|
|
105
106
|
|
|
106
107
|
def build(self) -> Sequence[GeneratorError]:
|
|
107
108
|
"""Create the project from templates"""
|
|
@@ -147,8 +148,8 @@ class Project:
|
|
|
147
148
|
)
|
|
148
149
|
)
|
|
149
150
|
|
|
150
|
-
def _get_errors(self) ->
|
|
151
|
-
errors:
|
|
151
|
+
def _get_errors(self) -> list[GeneratorError]:
|
|
152
|
+
errors: list[GeneratorError] = []
|
|
152
153
|
for collection in self.openapi.endpoint_collections_by_tag.values():
|
|
153
154
|
errors.extend(collection.parse_errors)
|
|
154
155
|
errors.extend(self.openapi.errors)
|
|
@@ -325,7 +326,7 @@ def generate(
|
|
|
325
326
|
return project.build()
|
|
326
327
|
|
|
327
328
|
|
|
328
|
-
def _load_yaml_or_json(data: bytes, content_type: Optional[str]) -> Union[
|
|
329
|
+
def _load_yaml_or_json(data: bytes, content_type: Optional[str]) -> Union[dict[str, Any], GeneratorError]:
|
|
329
330
|
if content_type == "application/json":
|
|
330
331
|
try:
|
|
331
332
|
return json.loads(data.decode())
|
|
@@ -339,7 +340,7 @@ def _load_yaml_or_json(data: bytes, content_type: Optional[str]) -> Union[Dict[s
|
|
|
339
340
|
return GeneratorError(header=f"Invalid YAML from provided source: {err}")
|
|
340
341
|
|
|
341
342
|
|
|
342
|
-
def _get_document(*, source: Union[str, Path], timeout: int) -> Union[
|
|
343
|
+
def _get_document(*, source: Union[str, Path], timeout: int) -> Union[dict[str, Any], GeneratorError]:
|
|
343
344
|
yaml_bytes: bytes
|
|
344
345
|
content_type: Optional[str]
|
|
345
346
|
if isinstance(source, str):
|
{openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/config.py
RENAMED
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
import mimetypes
|
|
3
3
|
from enum import Enum
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Optional, Union
|
|
6
6
|
|
|
7
7
|
from attr import define
|
|
8
8
|
from pydantic import BaseModel
|
|
@@ -34,13 +34,13 @@ class ConfigFile(BaseModel):
|
|
|
34
34
|
See https://github.com/openapi-generators/openapi-python-client#configuration
|
|
35
35
|
"""
|
|
36
36
|
|
|
37
|
-
class_overrides: Optional[
|
|
38
|
-
content_type_overrides: Optional[
|
|
37
|
+
class_overrides: Optional[dict[str, ClassOverride]] = None
|
|
38
|
+
content_type_overrides: Optional[dict[str, str]] = None
|
|
39
39
|
project_name_override: Optional[str] = None
|
|
40
40
|
package_name_override: Optional[str] = None
|
|
41
41
|
package_version_override: Optional[str] = None
|
|
42
42
|
use_path_prefixes_for_title_model_names: bool = True
|
|
43
|
-
post_hooks: Optional[
|
|
43
|
+
post_hooks: Optional[list[str]] = None
|
|
44
44
|
field_prefix: str = "field_"
|
|
45
45
|
http_timeout: int = 5
|
|
46
46
|
literal_enums: bool = False
|
|
@@ -63,18 +63,18 @@ class Config:
|
|
|
63
63
|
"""Contains all the config values for the generator, from files, defaults, and CLI arguments."""
|
|
64
64
|
|
|
65
65
|
meta_type: MetaType
|
|
66
|
-
class_overrides:
|
|
66
|
+
class_overrides: dict[str, ClassOverride]
|
|
67
67
|
project_name_override: Optional[str]
|
|
68
68
|
package_name_override: Optional[str]
|
|
69
69
|
package_version_override: Optional[str]
|
|
70
70
|
use_path_prefixes_for_title_model_names: bool
|
|
71
|
-
post_hooks:
|
|
71
|
+
post_hooks: list[str]
|
|
72
72
|
field_prefix: str
|
|
73
73
|
http_timeout: int
|
|
74
74
|
literal_enums: bool
|
|
75
75
|
document_source: Union[Path, str]
|
|
76
76
|
file_encoding: str
|
|
77
|
-
content_type_overrides:
|
|
77
|
+
content_type_overrides: dict[str, str]
|
|
78
78
|
overwrite: bool
|
|
79
79
|
output_path: Optional[Path]
|
|
80
80
|
|
{openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/bodies.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Union
|
|
3
3
|
|
|
4
4
|
import attr
|
|
5
5
|
|
|
@@ -44,10 +44,10 @@ def body_from_data(
|
|
|
44
44
|
*,
|
|
45
45
|
data: oai.Operation,
|
|
46
46
|
schemas: Schemas,
|
|
47
|
-
request_bodies:
|
|
47
|
+
request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]],
|
|
48
48
|
config: Config,
|
|
49
49
|
endpoint_name: str,
|
|
50
|
-
) ->
|
|
50
|
+
) -> tuple[list[Union[Body, ParseError]], Schemas]:
|
|
51
51
|
"""Adds form or JSON body to Endpoint if included in data"""
|
|
52
52
|
body = _resolve_reference(data.request_body, request_bodies)
|
|
53
53
|
if isinstance(body, ParseError):
|
|
@@ -55,7 +55,7 @@ def body_from_data(
|
|
|
55
55
|
if body is None:
|
|
56
56
|
return [], schemas
|
|
57
57
|
|
|
58
|
-
bodies:
|
|
58
|
+
bodies: list[Union[Body, ParseError]] = []
|
|
59
59
|
body_content = body.content
|
|
60
60
|
prefix_type_names = len(body_content) > 1
|
|
61
61
|
|
|
@@ -131,7 +131,7 @@ def body_from_data(
|
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
def _resolve_reference(
|
|
134
|
-
body: Union[oai.RequestBody, oai.Reference, None], request_bodies:
|
|
134
|
+
body: Union[oai.RequestBody, oai.Reference, None], request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]]
|
|
135
135
|
) -> Union[oai.RequestBody, ParseError, None]:
|
|
136
136
|
if body is None:
|
|
137
137
|
return None
|
{openapi_python_client-0.21.6 → openapi_python_client-0.22.0}/openapi_python_client/parser/errors.py
RENAMED
|
@@ -2,7 +2,7 @@ from dataclasses import dataclass
|
|
|
2
2
|
from enum import Enum
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
|
-
__all__ = ["ErrorLevel", "GeneratorError", "
|
|
5
|
+
__all__ = ["ErrorLevel", "GeneratorError", "ParameterError", "ParseError", "PropertyError"]
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel
|
|
8
8
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import re
|
|
2
|
+
from collections.abc import Iterator
|
|
2
3
|
from copy import deepcopy
|
|
3
4
|
from dataclasses import dataclass, field
|
|
4
5
|
from http import HTTPStatus
|
|
5
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Optional, Protocol, Union
|
|
6
7
|
|
|
7
8
|
from pydantic import ValidationError
|
|
8
9
|
|
|
@@ -40,20 +41,20 @@ class EndpointCollection:
|
|
|
40
41
|
"""A bunch of endpoints grouped under a tag that will become a module"""
|
|
41
42
|
|
|
42
43
|
tag: str
|
|
43
|
-
endpoints:
|
|
44
|
-
parse_errors:
|
|
44
|
+
endpoints: list["Endpoint"] = field(default_factory=list)
|
|
45
|
+
parse_errors: list[ParseError] = field(default_factory=list)
|
|
45
46
|
|
|
46
47
|
@staticmethod
|
|
47
48
|
def from_data(
|
|
48
49
|
*,
|
|
49
|
-
data:
|
|
50
|
+
data: dict[str, oai.PathItem],
|
|
50
51
|
schemas: Schemas,
|
|
51
52
|
parameters: Parameters,
|
|
52
|
-
request_bodies:
|
|
53
|
+
request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]],
|
|
53
54
|
config: Config,
|
|
54
|
-
) ->
|
|
55
|
+
) -> tuple[dict[utils.PythonIdentifier, "EndpointCollection"], Schemas, Parameters]:
|
|
55
56
|
"""Parse the openapi paths data to get EndpointCollections by tag"""
|
|
56
|
-
endpoints_by_tag:
|
|
57
|
+
endpoints_by_tag: dict[utils.PythonIdentifier, EndpointCollection] = {}
|
|
57
58
|
|
|
58
59
|
methods = ["get", "put", "post", "delete", "options", "head", "patch", "trace"]
|
|
59
60
|
|
|
@@ -117,7 +118,7 @@ class RequestBodyParser(Protocol):
|
|
|
117
118
|
|
|
118
119
|
def __call__(
|
|
119
120
|
self, *, body: oai.RequestBody, schemas: Schemas, parent_name: str, config: Config
|
|
120
|
-
) ->
|
|
121
|
+
) -> tuple[Union[Property, PropertyError, None], Schemas]: ... # pragma: no cover
|
|
121
122
|
|
|
122
123
|
|
|
123
124
|
@dataclass
|
|
@@ -133,19 +134,19 @@ class Endpoint:
|
|
|
133
134
|
requires_security: bool
|
|
134
135
|
tag: str
|
|
135
136
|
summary: Optional[str] = ""
|
|
136
|
-
relative_imports:
|
|
137
|
-
query_parameters:
|
|
138
|
-
path_parameters:
|
|
139
|
-
header_parameters:
|
|
140
|
-
cookie_parameters:
|
|
141
|
-
responses:
|
|
142
|
-
bodies:
|
|
143
|
-
errors:
|
|
137
|
+
relative_imports: set[str] = field(default_factory=set)
|
|
138
|
+
query_parameters: list[Property] = field(default_factory=list)
|
|
139
|
+
path_parameters: list[Property] = field(default_factory=list)
|
|
140
|
+
header_parameters: list[Property] = field(default_factory=list)
|
|
141
|
+
cookie_parameters: list[Property] = field(default_factory=list)
|
|
142
|
+
responses: list[Response] = field(default_factory=list)
|
|
143
|
+
bodies: list[Body] = field(default_factory=list)
|
|
144
|
+
errors: list[ParseError] = field(default_factory=list)
|
|
144
145
|
|
|
145
146
|
@staticmethod
|
|
146
147
|
def _add_responses(
|
|
147
148
|
*, endpoint: "Endpoint", data: oai.Responses, schemas: Schemas, config: Config
|
|
148
|
-
) ->
|
|
149
|
+
) -> tuple["Endpoint", Schemas]:
|
|
149
150
|
endpoint = deepcopy(endpoint)
|
|
150
151
|
for code, response_data in data.items():
|
|
151
152
|
status_code: HTTPStatus
|
|
@@ -197,7 +198,7 @@ class Endpoint:
|
|
|
197
198
|
schemas: Schemas,
|
|
198
199
|
parameters: Parameters,
|
|
199
200
|
config: Config,
|
|
200
|
-
) ->
|
|
201
|
+
) -> tuple[Union["Endpoint", ParseError], Schemas, Parameters]:
|
|
201
202
|
"""Process the defined `parameters` for an Endpoint.
|
|
202
203
|
|
|
203
204
|
Any existing parameters will be ignored, so earlier instances of a parameter take precedence. PathItem
|
|
@@ -226,8 +227,8 @@ class Endpoint:
|
|
|
226
227
|
|
|
227
228
|
endpoint = deepcopy(endpoint)
|
|
228
229
|
|
|
229
|
-
unique_parameters:
|
|
230
|
-
parameters_by_location:
|
|
230
|
+
unique_parameters: set[tuple[str, oai.ParameterLocation]] = set()
|
|
231
|
+
parameters_by_location: dict[str, list[Property]] = {
|
|
231
232
|
oai.ParameterLocation.QUERY: endpoint.query_parameters,
|
|
232
233
|
oai.ParameterLocation.PATH: endpoint.path_parameters,
|
|
233
234
|
oai.ParameterLocation.HEADER: endpoint.header_parameters,
|
|
@@ -304,7 +305,7 @@ class Endpoint:
|
|
|
304
305
|
self,
|
|
305
306
|
*,
|
|
306
307
|
config: Config,
|
|
307
|
-
previously_modified_params: Optional[
|
|
308
|
+
previously_modified_params: Optional[set[tuple[oai.ParameterLocation, str]]] = None,
|
|
308
309
|
) -> Union["Endpoint", ParseError]:
|
|
309
310
|
"""Check for conflicting parameters
|
|
310
311
|
|
|
@@ -316,7 +317,7 @@ class Endpoint:
|
|
|
316
317
|
unique python_name.
|
|
317
318
|
"""
|
|
318
319
|
modified_params = previously_modified_params or set()
|
|
319
|
-
used_python_names:
|
|
320
|
+
used_python_names: dict[PythonIdentifier, tuple[oai.ParameterLocation, Property]] = {}
|
|
320
321
|
reserved_names = ["client", "url"]
|
|
321
322
|
for parameter in self.iter_all_parameters():
|
|
322
323
|
location, prop = parameter
|
|
@@ -395,9 +396,9 @@ class Endpoint:
|
|
|
395
396
|
tag: str,
|
|
396
397
|
schemas: Schemas,
|
|
397
398
|
parameters: Parameters,
|
|
398
|
-
request_bodies:
|
|
399
|
+
request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]],
|
|
399
400
|
config: Config,
|
|
400
|
-
) ->
|
|
401
|
+
) -> tuple[Union["Endpoint", ParseError], Schemas, Parameters]:
|
|
401
402
|
"""Construct an endpoint from the OpenAPI data"""
|
|
402
403
|
|
|
403
404
|
if data.operationId is None:
|
|
@@ -461,15 +462,15 @@ class Endpoint:
|
|
|
461
462
|
return self.responses[0].prop.get_type_string(quoted=False)
|
|
462
463
|
return f"Union[{', '.join(types)}]"
|
|
463
464
|
|
|
464
|
-
def iter_all_parameters(self) -> Iterator[
|
|
465
|
+
def iter_all_parameters(self) -> Iterator[tuple[oai.ParameterLocation, Property]]:
|
|
465
466
|
"""Iterate through all the parameters of this endpoint"""
|
|
466
467
|
yield from ((oai.ParameterLocation.PATH, param) for param in self.path_parameters)
|
|
467
468
|
yield from ((oai.ParameterLocation.QUERY, param) for param in self.query_parameters)
|
|
468
469
|
yield from ((oai.ParameterLocation.HEADER, param) for param in self.header_parameters)
|
|
469
470
|
yield from ((oai.ParameterLocation.COOKIE, param) for param in self.cookie_parameters)
|
|
470
471
|
|
|
471
|
-
def list_all_parameters(self) ->
|
|
472
|
-
"""Return a
|
|
472
|
+
def list_all_parameters(self) -> list[Property]:
|
|
473
|
+
"""Return a list of all the parameters of this endpoint"""
|
|
473
474
|
return (
|
|
474
475
|
self.path_parameters
|
|
475
476
|
+ self.query_parameters
|
|
@@ -487,12 +488,12 @@ class GeneratorData:
|
|
|
487
488
|
description: Optional[str]
|
|
488
489
|
version: str
|
|
489
490
|
models: Iterator[ModelProperty]
|
|
490
|
-
errors:
|
|
491
|
-
endpoint_collections_by_tag:
|
|
491
|
+
errors: list[ParseError]
|
|
492
|
+
endpoint_collections_by_tag: dict[utils.PythonIdentifier, EndpointCollection]
|
|
492
493
|
enums: Iterator[Union[EnumProperty, LiteralEnumProperty]]
|
|
493
494
|
|
|
494
495
|
@staticmethod
|
|
495
|
-
def from_dict(data:
|
|
496
|
+
def from_dict(data: dict[str, Any], *, config: Config) -> Union["GeneratorData", GeneratorError]:
|
|
496
497
|
"""Create an OpenAPI from dict"""
|
|
497
498
|
try:
|
|
498
499
|
openapi = oai.OpenAPI.model_validate(data)
|
|
@@ -9,12 +9,12 @@ __all__ = [
|
|
|
9
9
|
"Parameters",
|
|
10
10
|
"Property",
|
|
11
11
|
"Schemas",
|
|
12
|
-
"build_schemas",
|
|
13
12
|
"build_parameters",
|
|
13
|
+
"build_schemas",
|
|
14
14
|
"property_from_data",
|
|
15
15
|
]
|
|
16
16
|
|
|
17
|
-
from
|
|
17
|
+
from collections.abc import Iterable
|
|
18
18
|
|
|
19
19
|
from attrs import evolve
|
|
20
20
|
|
|
@@ -111,7 +111,7 @@ class ConstProperty(PropertyProtocol):
|
|
|
111
111
|
back to the root of the generated client.
|
|
112
112
|
"""
|
|
113
113
|
if self.required:
|
|
114
|
-
return {"from typing import Literal"}
|
|
114
|
+
return {"from typing import Literal, cast"}
|
|
115
115
|
return {
|
|
116
116
|
"from typing import Literal, Union, cast",
|
|
117
117
|
f"from {prefix}types import UNSET, Unset",
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
__all__ = ["EnumProperty", "ValueType"]
|
|
4
4
|
|
|
5
|
-
from typing import Any, ClassVar,
|
|
5
|
+
from typing import Any, ClassVar, Union, cast
|
|
6
6
|
|
|
7
7
|
from attr import evolve
|
|
8
8
|
from attrs import define
|
|
@@ -99,7 +99,7 @@ class EnumProperty(PropertyProtocol):
|
|
|
99
99
|
if value_type not in (str, int):
|
|
100
100
|
return PropertyError(header=f"Unsupported enum type {value_type}", data=data), schemas
|
|
101
101
|
value_list = cast(
|
|
102
|
-
Union[
|
|
102
|
+
Union[list[int], list[str]], unchecked_value_list
|
|
103
103
|
) # We checked this with all the value_types stuff
|
|
104
104
|
|
|
105
105
|
if len(value_list) < len(enum): # Only one of the values was None, that becomes a union
|
|
@@ -106,10 +106,10 @@ class ListProperty(PropertyProtocol):
|
|
|
106
106
|
return None # pragma: no cover
|
|
107
107
|
|
|
108
108
|
def get_base_type_string(self, *, quoted: bool = False) -> str:
|
|
109
|
-
return f"
|
|
109
|
+
return f"list[{self.inner_property.get_type_string(quoted=not self.inner_property.is_base_type)}]"
|
|
110
110
|
|
|
111
111
|
def get_base_json_type_string(self, *, quoted: bool = False) -> str:
|
|
112
|
-
return f"
|
|
112
|
+
return f"list[{self.inner_property.get_type_string(json=True, quoted=not self.inner_property.is_base_type)}]"
|
|
113
113
|
|
|
114
114
|
def get_instance_type_string(self) -> str:
|
|
115
115
|
"""Get a string representation of runtime type that should be used for `isinstance` checks"""
|
|
@@ -125,7 +125,7 @@ class ListProperty(PropertyProtocol):
|
|
|
125
125
|
"""
|
|
126
126
|
imports = super().get_imports(prefix=prefix)
|
|
127
127
|
imports.update(self.inner_property.get_imports(prefix=prefix))
|
|
128
|
-
imports.add("from typing import cast
|
|
128
|
+
imports.add("from typing import cast")
|
|
129
129
|
return imports
|
|
130
130
|
|
|
131
131
|
def get_lazy_imports(self, *, prefix: str) -> set[str]:
|
|
@@ -151,7 +151,7 @@ class ListProperty(PropertyProtocol):
|
|
|
151
151
|
if json:
|
|
152
152
|
type_string = self.get_base_json_type_string()
|
|
153
153
|
elif multipart:
|
|
154
|
-
type_string = "
|
|
154
|
+
type_string = "tuple[None, bytes, str]"
|
|
155
155
|
else:
|
|
156
156
|
type_string = self.get_base_type_string()
|
|
157
157
|
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
__all__ = ["LiteralEnumProperty"]
|
|
4
4
|
|
|
5
|
-
from typing import Any, ClassVar,
|
|
5
|
+
from typing import Any, ClassVar, Union, cast
|
|
6
6
|
|
|
7
7
|
from attr import evolve
|
|
8
8
|
from attrs import define
|
|
@@ -98,7 +98,7 @@ class LiteralEnumProperty(PropertyProtocol):
|
|
|
98
98
|
if value_type not in (str, int):
|
|
99
99
|
return PropertyError(header=f"Unsupported enum type {value_type}", data=data), schemas
|
|
100
100
|
value_list = cast(
|
|
101
|
-
Union[
|
|
101
|
+
Union[list[int], list[str]], unchecked_value_list
|
|
102
102
|
) # We checked this with all the value_types stuff
|
|
103
103
|
|
|
104
104
|
if len(value_list) < len(enum): # Only one of the values was None, that becomes a union
|
|
@@ -32,7 +32,7 @@ class ModelProperty(PropertyProtocol):
|
|
|
32
32
|
relative_imports: set[str] | None
|
|
33
33
|
lazy_imports: set[str] | None
|
|
34
34
|
additional_properties: Property | None
|
|
35
|
-
_json_type_string: ClassVar[str] = "
|
|
35
|
+
_json_type_string: ClassVar[str] = "dict[str, Any]"
|
|
36
36
|
|
|
37
37
|
template: ClassVar[str] = "model_property.py.jinja"
|
|
38
38
|
json_is_dict: ClassVar[bool] = True
|
|
@@ -154,7 +154,6 @@ class ModelProperty(PropertyProtocol):
|
|
|
154
154
|
imports = super().get_imports(prefix=prefix)
|
|
155
155
|
imports.update(
|
|
156
156
|
{
|
|
157
|
-
"from typing import Dict",
|
|
158
157
|
"from typing import cast",
|
|
159
158
|
}
|
|
160
159
|
)
|
|
@@ -203,7 +202,7 @@ class ModelProperty(PropertyProtocol):
|
|
|
203
202
|
if json:
|
|
204
203
|
type_string = self.get_base_json_type_string()
|
|
205
204
|
elif multipart:
|
|
206
|
-
type_string = "
|
|
205
|
+
type_string = "tuple[None, bytes, str]"
|
|
207
206
|
else:
|
|
208
207
|
type_string = self.get_base_type_string()
|
|
209
208
|
|
|
@@ -116,7 +116,7 @@ class PropertyProtocol(Protocol):
|
|
|
116
116
|
if json:
|
|
117
117
|
type_string = self.get_base_json_type_string(quoted=quoted)
|
|
118
118
|
elif multipart:
|
|
119
|
-
type_string = "
|
|
119
|
+
type_string = "tuple[None, bytes, str]"
|
|
120
120
|
else:
|
|
121
121
|
type_string = self.get_base_type_string(quoted=quoted)
|
|
122
122
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
__all__ = [
|
|
2
2
|
"Class",
|
|
3
|
-
"Schemas",
|
|
4
3
|
"Parameters",
|
|
5
4
|
"ReferencePath",
|
|
5
|
+
"Schemas",
|
|
6
|
+
"parameter_from_data",
|
|
7
|
+
"parameter_from_reference",
|
|
6
8
|
"parse_reference_path",
|
|
7
|
-
"update_schemas_with_data",
|
|
8
9
|
"update_parameters_with_data",
|
|
9
|
-
"
|
|
10
|
-
"parameter_from_data",
|
|
10
|
+
"update_schemas_with_data",
|
|
11
11
|
]
|
|
12
12
|
|
|
13
|
-
from typing import TYPE_CHECKING,
|
|
13
|
+
from typing import TYPE_CHECKING, NewType, Union, cast
|
|
14
14
|
from urllib.parse import urlparse
|
|
15
15
|
|
|
16
16
|
from attrs import define, evolve, field
|
|
@@ -76,13 +76,13 @@ class Class:
|
|
|
76
76
|
class Schemas:
|
|
77
77
|
"""Structure for containing all defined, shareable, and reusable schemas (attr classes and Enums)"""
|
|
78
78
|
|
|
79
|
-
classes_by_reference:
|
|
80
|
-
dependencies:
|
|
81
|
-
classes_by_name:
|
|
82
|
-
models_to_process:
|
|
83
|
-
errors:
|
|
79
|
+
classes_by_reference: dict[ReferencePath, Property] = field(factory=dict)
|
|
80
|
+
dependencies: dict[ReferencePath, set[Union[ReferencePath, ClassName]]] = field(factory=dict)
|
|
81
|
+
classes_by_name: dict[ClassName, Property] = field(factory=dict)
|
|
82
|
+
models_to_process: list[ModelProperty] = field(factory=list)
|
|
83
|
+
errors: list[ParseError] = field(factory=list)
|
|
84
84
|
|
|
85
|
-
def add_dependencies(self, ref_path: ReferencePath, roots:
|
|
85
|
+
def add_dependencies(self, ref_path: ReferencePath, roots: set[Union[ReferencePath, ClassName]]) -> None:
|
|
86
86
|
"""Record new dependencies on the given ReferencePath
|
|
87
87
|
|
|
88
88
|
Args:
|
|
@@ -143,9 +143,9 @@ def update_schemas_with_data(
|
|
|
143
143
|
class Parameters:
|
|
144
144
|
"""Structure for containing all defined, shareable, and reusable parameters"""
|
|
145
145
|
|
|
146
|
-
classes_by_reference:
|
|
147
|
-
classes_by_name:
|
|
148
|
-
errors:
|
|
146
|
+
classes_by_reference: dict[ReferencePath, Parameter] = field(factory=dict)
|
|
147
|
+
classes_by_name: dict[ClassName, Parameter] = field(factory=dict)
|
|
148
|
+
errors: list[ParseError] = field(factory=list)
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
def parameter_from_data(
|
|
@@ -154,7 +154,7 @@ def parameter_from_data(
|
|
|
154
154
|
data: Union[oai.Reference, oai.Parameter],
|
|
155
155
|
parameters: Parameters,
|
|
156
156
|
config: Config,
|
|
157
|
-
) ->
|
|
157
|
+
) -> tuple[Union[Parameter, ParameterError], Parameters]:
|
|
158
158
|
"""Generates parameters from an OpenAPI Parameter spec."""
|
|
159
159
|
|
|
160
160
|
if isinstance(data, oai.Reference):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
__all__ = ["Response", "response_from_data"]
|
|
2
2
|
|
|
3
3
|
from http import HTTPStatus
|
|
4
|
-
from typing import Optional,
|
|
4
|
+
from typing import Optional, TypedDict, Union
|
|
5
5
|
|
|
6
6
|
from attrs import define
|
|
7
7
|
|
|
@@ -86,7 +86,7 @@ def response_from_data(
|
|
|
86
86
|
schemas: Schemas,
|
|
87
87
|
parent_name: str,
|
|
88
88
|
config: Config,
|
|
89
|
-
) ->
|
|
89
|
+
) -> tuple[Union[Response, ParseError], Schemas]:
|
|
90
90
|
"""Generate a Response from the OpenAPI dictionary representation of it"""
|
|
91
91
|
|
|
92
92
|
response_name = f"response_{status_code}"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
2
|
|
|
3
3
|
if TYPE_CHECKING: # pragma: no cover
|
|
4
4
|
from .path_item import PathItem
|
|
5
5
|
else:
|
|
6
6
|
PathItem = "PathItem"
|
|
7
7
|
|
|
8
|
-
Callback =
|
|
8
|
+
Callback = dict[str, PathItem]
|
|
9
9
|
"""
|
|
10
10
|
A map of possible out-of band callbacks related to the parent operation.
|
|
11
11
|
Each value in the map is a [Path Item Object](#pathItemObject)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Optional, Union
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, ConfigDict
|
|
4
4
|
|
|
@@ -25,15 +25,15 @@ class Components(BaseModel):
|
|
|
25
25
|
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
-
schemas: Optional[
|
|
29
|
-
responses: Optional[
|
|
30
|
-
parameters: Optional[
|
|
31
|
-
examples: Optional[
|
|
32
|
-
requestBodies: Optional[
|
|
33
|
-
headers: Optional[
|
|
34
|
-
securitySchemes: Optional[
|
|
35
|
-
links: Optional[
|
|
36
|
-
callbacks: Optional[
|
|
28
|
+
schemas: Optional[dict[str, Union[Schema, Reference]]] = None
|
|
29
|
+
responses: Optional[dict[str, Union[Response, Reference]]] = None
|
|
30
|
+
parameters: Optional[dict[str, Union[Parameter, Reference]]] = None
|
|
31
|
+
examples: Optional[dict[str, Union[Example, Reference]]] = None
|
|
32
|
+
requestBodies: Optional[dict[str, Union[RequestBody, Reference]]] = None
|
|
33
|
+
headers: Optional[dict[str, Union[Header, Reference]]] = None
|
|
34
|
+
securitySchemes: Optional[dict[str, Union[SecurityScheme, Reference]]] = None
|
|
35
|
+
links: Optional[dict[str, Union[Link, Reference]]] = None
|
|
36
|
+
callbacks: Optional[dict[str, Union[Callback, Reference]]] = None
|
|
37
37
|
model_config = ConfigDict(
|
|
38
38
|
extra="allow",
|
|
39
39
|
json_schema_extra={
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Optional
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, ConfigDict
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ class Discriminator(BaseModel):
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
propertyName: str
|
|
22
|
-
mapping: Optional[
|
|
22
|
+
mapping: Optional[dict[str, str]] = None
|
|
23
23
|
model_config = ConfigDict(
|
|
24
24
|
extra="allow",
|
|
25
25
|
json_schema_extra={
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING,
|
|
1
|
+
from typing import TYPE_CHECKING, Optional, Union
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, ConfigDict
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ class Encoding(BaseModel):
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
contentType: Optional[str] = None
|
|
22
|
-
headers: Optional[
|
|
22
|
+
headers: Optional[dict[str, Union[Header, Reference]]] = None
|
|
23
23
|
style: Optional[str] = None
|
|
24
24
|
explode: bool = False
|
|
25
25
|
allowReserved: bool = False
|