openapi-python-client 0.24.0__tar.gz → 0.24.1__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.
Files changed (111) hide show
  1. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/PKG-INFO +3 -3
  2. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/components.py +11 -11
  3. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +3 -3
  4. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/media_type.py +4 -4
  5. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/operation.py +4 -4
  6. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/parameter.py +4 -4
  7. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/path_item.py +3 -3
  8. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/reference.py +18 -1
  9. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/response.py +4 -4
  10. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/responses.py +2 -4
  11. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/schema.py +9 -9
  12. openapi_python_client-0.24.1/openapi_python_client/templates/endpoint_init.py.jinja +1 -0
  13. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/model.py.jinja +3 -2
  14. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/pyproject.toml +5 -6
  15. openapi_python_client-0.24.0/openapi_python_client/templates/endpoint_init.py.jinja +0 -0
  16. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/.gitignore +0 -0
  17. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/LICENSE +0 -0
  18. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/README.md +0 -0
  19. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/__init__.py +0 -0
  20. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/__main__.py +0 -0
  21. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/cli.py +0 -0
  22. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/config.py +0 -0
  23. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/__init__.py +0 -0
  24. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/bodies.py +0 -0
  25. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/errors.py +0 -0
  26. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/openapi.py +0 -0
  27. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/__init__.py +0 -0
  28. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/any.py +0 -0
  29. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/boolean.py +0 -0
  30. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/const.py +0 -0
  31. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/date.py +0 -0
  32. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/datetime.py +0 -0
  33. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/enum_property.py +0 -0
  34. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/file.py +0 -0
  35. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/float.py +0 -0
  36. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/int.py +0 -0
  37. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/list_property.py +0 -0
  38. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/literal_enum_property.py +0 -0
  39. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/merge_properties.py +0 -0
  40. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/model_property.py +0 -0
  41. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/none.py +0 -0
  42. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/property.py +0 -0
  43. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/protocol.py +0 -0
  44. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/schemas.py +0 -0
  45. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/string.py +0 -0
  46. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/union.py +0 -0
  47. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/properties/uuid.py +0 -0
  48. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/parser/responses.py +0 -0
  49. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/py.typed +0 -0
  50. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/3.0.3.md +0 -0
  51. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/3.1.0.md +0 -0
  52. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/__init__.py +0 -0
  53. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/data_type.py +0 -0
  54. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/LICENSE +0 -0
  55. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/README.md +0 -0
  56. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/__init__.py +0 -0
  57. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/callback.py +0 -0
  58. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/contact.py +0 -0
  59. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py +0 -0
  60. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/example.py +0 -0
  61. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py +0 -0
  62. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/header.py +0 -0
  63. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/info.py +0 -0
  64. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/license.py +0 -0
  65. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/link.py +0 -0
  66. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py +0 -0
  67. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py +0 -0
  68. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +0 -0
  69. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/paths.py +0 -0
  70. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/request_body.py +0 -0
  71. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py +0 -0
  72. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py +0 -0
  73. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/server.py +0 -0
  74. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py +0 -0
  75. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/tag.py +0 -0
  76. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/openapi_schema_pydantic/xml.py +0 -0
  77. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/schema/parameter_location.py +0 -0
  78. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/.gitignore.jinja +0 -0
  79. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/README.md.jinja +0 -0
  80. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/api_init.py.jinja +0 -0
  81. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/client.py.jinja +0 -0
  82. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/endpoint_macros.py.jinja +0 -0
  83. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/endpoint_module.py.jinja +0 -0
  84. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/errors.py.jinja +0 -0
  85. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/helpers.jinja +0 -0
  86. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/int_enum.py.jinja +0 -0
  87. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/literal_enum.py.jinja +0 -0
  88. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/models_init.py.jinja +0 -0
  89. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/package_init.py.jinja +0 -0
  90. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/any_property.py.jinja +0 -0
  91. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/boolean_property.py.jinja +0 -0
  92. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/const_property.py.jinja +0 -0
  93. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/date_property.py.jinja +0 -0
  94. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/datetime_property.py.jinja +0 -0
  95. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/enum_property.py.jinja +0 -0
  96. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/file_property.py.jinja +0 -0
  97. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/float_property.py.jinja +0 -0
  98. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/helpers.jinja +0 -0
  99. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/int_property.py.jinja +0 -0
  100. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/list_property.py.jinja +0 -0
  101. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/literal_enum_property.py.jinja +0 -0
  102. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/model_property.py.jinja +0 -0
  103. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/property_macros.py.jinja +0 -0
  104. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/union_property.py.jinja +0 -0
  105. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/property_templates/uuid_property.py.jinja +0 -0
  106. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/pyproject.toml.jinja +0 -0
  107. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/pyproject_ruff.toml.jinja +0 -0
  108. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/setup.py.jinja +0 -0
  109. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/str_enum.py.jinja +0 -0
  110. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/templates/types.py.jinja +0 -0
  111. {openapi_python_client-0.24.0 → openapi_python_client-0.24.1}/openapi_python_client/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openapi-python-client
3
- Version: 0.24.0
3
+ Version: 0.24.1
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>
@@ -23,10 +23,10 @@ Requires-Dist: attrs>=22.2.0
23
23
  Requires-Dist: colorama>=0.4.3; sys_platform == 'win32'
24
24
  Requires-Dist: httpx<0.29.0,>=0.20.0
25
25
  Requires-Dist: jinja2<4.0.0,>=3.0.0
26
- Requires-Dist: pydantic<3.0.0,>=2.1.1
26
+ Requires-Dist: pydantic<3.0.0,>=2.10
27
27
  Requires-Dist: python-dateutil<3.0.0,>=2.8.1
28
28
  Requires-Dist: ruamel-yaml<0.19.0,>=0.18.6
29
- Requires-Dist: ruff<0.10,>=0.2
29
+ Requires-Dist: ruff<0.12,>=0.2
30
30
  Requires-Dist: shellingham<2.0.0,>=1.3.2
31
31
  Requires-Dist: typer<0.16,>0.6
32
32
  Requires-Dist: typing-extensions<5.0.0,>=4.8.0
@@ -1,4 +1,4 @@
1
- from typing import Optional, Union
1
+ from typing import Optional
2
2
 
3
3
  from pydantic import BaseModel, ConfigDict
4
4
 
@@ -7,7 +7,7 @@ from .example import Example
7
7
  from .header import Header
8
8
  from .link import Link
9
9
  from .parameter import Parameter
10
- from .reference import Reference
10
+ from .reference import ReferenceOr
11
11
  from .request_body import RequestBody
12
12
  from .response import Response
13
13
  from .schema import Schema
@@ -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[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
28
+ schemas: Optional[dict[str, ReferenceOr[Schema]]] = None
29
+ responses: Optional[dict[str, ReferenceOr[Response]]] = None
30
+ parameters: Optional[dict[str, ReferenceOr[Parameter]]] = None
31
+ examples: Optional[dict[str, ReferenceOr[Example]]] = None
32
+ requestBodies: Optional[dict[str, ReferenceOr[RequestBody]]] = None
33
+ headers: Optional[dict[str, ReferenceOr[Header]]] = None
34
+ securitySchemes: Optional[dict[str, ReferenceOr[SecurityScheme]]] = None
35
+ links: Optional[dict[str, ReferenceOr[Link]]] = None
36
+ callbacks: Optional[dict[str, ReferenceOr[Callback]]] = None
37
37
  model_config = ConfigDict(
38
38
  # `Callback` contains an unresolvable forward reference, will rebuild in `__init__.py`:
39
39
  defer_build=True,
@@ -1,8 +1,8 @@
1
- from typing import TYPE_CHECKING, Optional, Union
1
+ from typing import TYPE_CHECKING, Optional
2
2
 
3
3
  from pydantic import BaseModel, ConfigDict
4
4
 
5
- from .reference import Reference
5
+ from .reference import ReferenceOr
6
6
 
7
7
  if TYPE_CHECKING: # pragma: no cover
8
8
  from .header import Header
@@ -17,7 +17,7 @@ class Encoding(BaseModel):
17
17
  """
18
18
 
19
19
  contentType: Optional[str] = None
20
- headers: Optional[dict[str, Union["Header", Reference]]] = None
20
+ headers: Optional[dict[str, ReferenceOr["Header"]]] = None
21
21
  style: Optional[str] = None
22
22
  explode: bool = False
23
23
  allowReserved: bool = False
@@ -1,10 +1,10 @@
1
- from typing import Any, Optional, Union
1
+ from typing import Any, Optional
2
2
 
3
3
  from pydantic import BaseModel, ConfigDict, Field
4
4
 
5
5
  from .encoding import Encoding
6
6
  from .example import Example
7
- from .reference import Reference
7
+ from .reference import ReferenceOr
8
8
  from .schema import Schema
9
9
 
10
10
 
@@ -16,9 +16,9 @@ class MediaType(BaseModel):
16
16
  - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject
17
17
  """
18
18
 
19
- media_type_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema")
19
+ media_type_schema: Optional[ReferenceOr[Schema]] = Field(default=None, alias="schema")
20
20
  example: Optional[Any] = None
21
- examples: Optional[dict[str, Union[Example, Reference]]] = None
21
+ examples: Optional[dict[str, ReferenceOr[Example]]] = None
22
22
  encoding: Optional[dict[str, Encoding]] = None
23
23
  model_config = ConfigDict(
24
24
  # `Encoding` is not build yet, will rebuild in `__init__.py`:
@@ -1,11 +1,11 @@
1
- from typing import Optional, Union
1
+ from typing import Optional
2
2
 
3
3
  from pydantic import BaseModel, ConfigDict, Field
4
4
 
5
5
  from .callback import Callback
6
6
  from .external_documentation import ExternalDocumentation
7
7
  from .parameter import Parameter
8
- from .reference import Reference
8
+ from .reference import ReferenceOr
9
9
  from .request_body import RequestBody
10
10
  from .responses import Responses
11
11
  from .security_requirement import SecurityRequirement
@@ -25,8 +25,8 @@ class Operation(BaseModel):
25
25
  description: Optional[str] = None
26
26
  externalDocs: Optional[ExternalDocumentation] = None
27
27
  operationId: Optional[str] = None
28
- parameters: Optional[list[Union[Parameter, Reference]]] = None
29
- request_body: Optional[Union[RequestBody, Reference]] = Field(None, alias="requestBody")
28
+ parameters: Optional[list[ReferenceOr[Parameter]]] = None
29
+ request_body: Optional[ReferenceOr[RequestBody]] = Field(None, alias="requestBody")
30
30
  responses: Responses
31
31
  callbacks: Optional[dict[str, Callback]] = None
32
32
 
@@ -1,11 +1,11 @@
1
- from typing import Any, Optional, Union
1
+ from typing import Any, Optional
2
2
 
3
3
  from pydantic import BaseModel, ConfigDict, Field
4
4
 
5
5
  from ..parameter_location import ParameterLocation
6
6
  from .example import Example
7
7
  from .media_type import MediaType
8
- from .reference import Reference
8
+ from .reference import ReferenceOr
9
9
  from .schema import Schema
10
10
 
11
11
 
@@ -30,9 +30,9 @@ class Parameter(BaseModel):
30
30
  style: Optional[str] = None
31
31
  explode: bool = False
32
32
  allowReserved: bool = False
33
- param_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema")
33
+ param_schema: Optional[ReferenceOr[Schema]] = Field(default=None, alias="schema")
34
34
  example: Optional[Any] = None
35
- examples: Optional[dict[str, Union[Example, Reference]]] = None
35
+ examples: Optional[dict[str, ReferenceOr[Example]]] = None
36
36
  content: Optional[dict[str, MediaType]] = None
37
37
  model_config = ConfigDict(
38
38
  # `MediaType` is not build yet, will rebuild in `__init__.py`:
@@ -1,9 +1,9 @@
1
- from typing import TYPE_CHECKING, Optional, Union
1
+ from typing import TYPE_CHECKING, Optional
2
2
 
3
3
  from pydantic import BaseModel, ConfigDict, Field
4
4
 
5
5
  from .parameter import Parameter
6
- from .reference import Reference
6
+ from .reference import ReferenceOr
7
7
  from .server import Server
8
8
 
9
9
  if TYPE_CHECKING:
@@ -34,7 +34,7 @@ class PathItem(BaseModel):
34
34
  patch: Optional["Operation"] = None
35
35
  trace: Optional["Operation"] = None
36
36
  servers: Optional[list[Server]] = None
37
- parameters: Optional[list[Union[Parameter, Reference]]] = None
37
+ parameters: Optional[list[ReferenceOr[Parameter]]] = None
38
38
  model_config = ConfigDict(
39
39
  # `Operation` is an unresolvable forward reference, will rebuild in `__init__.py`:
40
40
  defer_build=True,
@@ -1,4 +1,7 @@
1
- from pydantic import BaseModel, ConfigDict, Field
1
+ from typing import Annotated, Any, Literal, TypeVar, Union
2
+
3
+ from pydantic import BaseModel, ConfigDict, Discriminator, Field, Tag
4
+ from typing_extensions import TypeAlias
2
5
 
3
6
 
4
7
  class Reference(BaseModel):
@@ -24,3 +27,17 @@ class Reference(BaseModel):
24
27
  "examples": [{"$ref": "#/components/schemas/Pet"}, {"$ref": "Pet.json"}, {"$ref": "definitions.json#/Pet"}]
25
28
  },
26
29
  )
30
+
31
+
32
+ T = TypeVar("T")
33
+
34
+
35
+ def _reference_discriminator(obj: Any) -> Literal["ref", "other"]:
36
+ if isinstance(obj, dict):
37
+ return "ref" if "$ref" in obj else "other"
38
+ return "ref" if isinstance(obj, Reference) else "other"
39
+
40
+
41
+ ReferenceOr: TypeAlias = Annotated[
42
+ Union[Annotated[Reference, Tag("ref")], Annotated[T, Tag("other")]], Discriminator(_reference_discriminator)
43
+ ]
@@ -1,11 +1,11 @@
1
- from typing import Optional, Union
1
+ from typing import Optional
2
2
 
3
3
  from pydantic import BaseModel, ConfigDict
4
4
 
5
5
  from .header import Header
6
6
  from .link import Link
7
7
  from .media_type import MediaType
8
- from .reference import Reference
8
+ from .reference import ReferenceOr
9
9
 
10
10
 
11
11
  class Response(BaseModel):
@@ -19,9 +19,9 @@ class Response(BaseModel):
19
19
  """
20
20
 
21
21
  description: str
22
- headers: Optional[dict[str, Union[Header, Reference]]] = None
22
+ headers: Optional[dict[str, ReferenceOr[Header]]] = None
23
23
  content: Optional[dict[str, MediaType]] = None
24
- links: Optional[dict[str, Union[Link, Reference]]] = None
24
+ links: Optional[dict[str, ReferenceOr[Link]]] = None
25
25
  model_config = ConfigDict(
26
26
  # `MediaType` is not build yet, will rebuild in `__init__.py`:
27
27
  defer_build=True,
@@ -1,9 +1,7 @@
1
- from typing import Union
2
-
3
- from .reference import Reference
1
+ from .reference import ReferenceOr
4
2
  from .response import Response
5
3
 
6
- Responses = dict[str, Union[Response, Reference]]
4
+ Responses = dict[str, ReferenceOr[Response]]
7
5
  """
8
6
  A container for the expected responses of an operation.
9
7
  The container maps a HTTP response code to the expected response.
@@ -5,7 +5,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, Stri
5
5
  from ..data_type import DataType
6
6
  from .discriminator import Discriminator
7
7
  from .external_documentation import ExternalDocumentation
8
- from .reference import Reference
8
+ from .reference import ReferenceOr
9
9
  from .xml import XML
10
10
 
11
11
 
@@ -38,14 +38,14 @@ class Schema(BaseModel):
38
38
  enum: Union[None, list[Any]] = Field(default=None, min_length=1)
39
39
  const: Union[None, StrictStr, StrictInt, StrictFloat, StrictBool] = None
40
40
  type: Union[DataType, list[DataType], None] = Field(default=None)
41
- allOf: list[Union[Reference, "Schema"]] = Field(default_factory=list)
42
- oneOf: list[Union[Reference, "Schema"]] = Field(default_factory=list)
43
- anyOf: list[Union[Reference, "Schema"]] = Field(default_factory=list)
44
- schema_not: Optional[Union[Reference, "Schema"]] = Field(default=None, alias="not")
45
- items: Optional[Union[Reference, "Schema"]] = None
46
- prefixItems: list[Union[Reference, "Schema"]] = Field(default_factory=list)
47
- properties: Optional[dict[str, Union[Reference, "Schema"]]] = None
48
- additionalProperties: Optional[Union[bool, Reference, "Schema"]] = None
41
+ allOf: list[ReferenceOr["Schema"]] = Field(default_factory=list)
42
+ oneOf: list[ReferenceOr["Schema"]] = Field(default_factory=list)
43
+ anyOf: list[ReferenceOr["Schema"]] = Field(default_factory=list)
44
+ schema_not: Optional[ReferenceOr["Schema"]] = Field(default=None, alias="not")
45
+ items: Optional[ReferenceOr["Schema"]] = None
46
+ prefixItems: list[ReferenceOr["Schema"]] = Field(default_factory=list)
47
+ properties: Optional[dict[str, ReferenceOr["Schema"]]] = None
48
+ additionalProperties: Optional[Union[bool, ReferenceOr["Schema"]]] = None
49
49
  description: Optional[str] = None
50
50
  schema_format: Optional[str] = Field(default=None, alias="format")
51
51
  default: Optional[Any] = None
@@ -0,0 +1 @@
1
+ """ Contains endpoint functions for accessing the API """
@@ -1,3 +1,4 @@
1
+ from collections.abc import Mapping
1
2
  from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING
2
3
 
3
4
  from attrs import define as _attrs_define
@@ -138,12 +139,12 @@ return field_dict
138
139
  {% endif %}
139
140
 
140
141
  @classmethod
141
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
142
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
142
143
  {% for lazy_import in model.lazy_imports %}
143
144
  {{ lazy_import }}
144
145
  {% endfor %}
145
146
  {% if (model.required_properties or model.optional_properties or model.additional_properties) %}
146
- d = src_dict.copy()
147
+ d = dict(src_dict)
147
148
  {% for property in model.required_properties + model.optional_properties %}
148
149
  {% if property.required %}
149
150
  {% set property_source = 'd.pop("' + property.name + '")' %}
@@ -9,16 +9,16 @@ dependencies = [
9
9
  "typer>0.6,<0.16",
10
10
  "colorama>=0.4.3; sys_platform == \"win32\"",
11
11
  "shellingham>=1.3.2,<2.0.0",
12
- "pydantic>=2.1.1,<3.0.0",
12
+ "pydantic>=2.10,<3.0.0",
13
13
  "attrs>=22.2.0",
14
14
  "python-dateutil>=2.8.1,<3.0.0",
15
15
  "httpx>=0.20.0,<0.29.0",
16
16
  "ruamel.yaml>=0.18.6,<0.19.0",
17
- "ruff>=0.2,<0.10",
17
+ "ruff>=0.2,<0.12",
18
18
  "typing-extensions>=4.8.0,<5.0.0",
19
19
  ]
20
20
  name = "openapi-python-client"
21
- version = "0.24.0"
21
+ version = "0.24.1"
22
22
  description = "Generate modern Python clients from OpenAPI"
23
23
  keywords = [
24
24
  "OpenAPI",
@@ -66,7 +66,7 @@ ignore = ["E501", "PLR0913", "PLR2004"]
66
66
  "tests/*" = ["PLR2004"]
67
67
 
68
68
  [tool.coverage.run]
69
- omit = ["openapi_python_client/__main__.py", "openapi_python_client/templates/*"]
69
+ omit = ["openapi_python_client/__main__.py", "openapi_python_client/templates/*", "end_to_end_tests/*", "integration_tests/*", "tests/*"]
70
70
 
71
71
  [tool.mypy]
72
72
  plugins = ["pydantic.mypy"]
@@ -95,7 +95,6 @@ dev = [
95
95
  "types-PyYAML<7.0.0,>=6.0.3",
96
96
  "types-certifi<2021.10.9,>=2020.0.0",
97
97
  "types-python-dateutil<3.0.0,>=2.0.0",
98
- "ruamel-yaml-string>=0.1.1",
99
98
  "syrupy>=4",
100
99
  ]
101
100
 
@@ -118,7 +117,7 @@ regen_e2e = "python -m end_to_end_tests.regen_golden_record"
118
117
  unit_test = "pytest tests"
119
118
 
120
119
  [tool.pdm.scripts.test]
121
- cmd = "pytest tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp"
120
+ cmd = "pytest tests end_to_end_tests/test_end_to_end.py end_to_end_tests/functional_tests --basetemp=tests/tmp"
122
121
  [tool.pdm.scripts.test.env]
123
122
  "TEST_RELATIVE" = "true"
124
123