openapi-python-generator 1.2.1.dev1757315868__tar.gz → 1.2.1.dev1757316547__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 (32) hide show
  1. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/PKG-INFO +1 -1
  2. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/pyproject.toml +1 -1
  3. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/setup.py +1 -1
  4. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/model_generator.py +6 -6
  5. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/service_generator.py +5 -5
  6. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/LICENSE +0 -0
  7. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/README.md +0 -0
  8. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/__init__.py +0 -0
  9. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/__main__.py +0 -0
  10. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/common.py +0 -0
  11. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/generate_data.py +0 -0
  12. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/__init__.py +0 -0
  13. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/__init__.py +0 -0
  14. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/api_config_generator.py +0 -0
  15. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/common.py +0 -0
  16. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/generator.py +0 -0
  17. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/jinja_config.py +0 -0
  18. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/aiohttp.jinja2 +0 -0
  19. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/apiconfig.jinja2 +0 -0
  20. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/apiconfig_pydantic_2.jinja2 +0 -0
  21. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/enum.jinja2 +0 -0
  22. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/httpx.jinja2 +0 -0
  23. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/models.jinja2 +0 -0
  24. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/models_pydantic_2.jinja2 +0 -0
  25. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/requests.jinja2 +0 -0
  26. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/language_converters/python/templates/service.jinja2 +0 -0
  27. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/models.py +0 -0
  28. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/parsers/__init__.py +0 -0
  29. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/parsers/openapi_30.py +0 -0
  30. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/parsers/openapi_31.py +0 -0
  31. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/py.typed +0 -0
  32. {openapi_python_generator-1.2.1.dev1757315868 → openapi_python_generator-1.2.1.dev1757316547}/src/openapi_python_generator/version_detector.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openapi-python-generator
3
- Version: 1.2.1.dev1757315868
3
+ Version: 1.2.1.dev1757316547
4
4
  Summary: Openapi Python Generator
5
5
  Home-page: https://github.com/MarcoMuellner/openapi-python-generator
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openapi-python-generator"
3
- version = "1.2.1.dev.1757315868"
3
+ version = "1.2.1.dev.1757316547"
4
4
  description = "Openapi Python Generator"
5
5
  authors = ["Marco Müllner <muellnermarco@gmail.com>"]
6
6
  license = "MIT"
@@ -32,7 +32,7 @@ entry_points = \
32
32
 
33
33
  setup_kwargs = {
34
34
  'name': 'openapi-python-generator',
35
- 'version': '1.2.1.dev1757315868',
35
+ 'version': '1.2.1.dev1757316547',
36
36
  'description': 'Openapi Python Generator',
37
37
  'long_description': "# Openapi Python Generator\n\n[![PyPI](https://img.shields.io/pypi/v/openapi-python-generator.svg)][pypi_]\n[![Status](https://img.shields.io/pypi/status/openapi-python-generator.svg)][status]\n[![Python Version](https://img.shields.io/pypi/pyversions/openapi-python-generator)][python version]\n[![License](https://img.shields.io/pypi/l/openapi-python-generator)][license]\n\n[![](https://img.shields.io/static/v1?label=documentation&message=enabled&color=<COLOR>)][documentation]\n[![Tests](https://github.com/MarcoMuellner/openapi-python-generator/workflows/Tests/badge.svg)][tests]\n[![Codecov](https://codecov.io/gh/MarcoMuellner/openapi-python-generator/branch/main/graph/badge.svg)][codecov]\n\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]\n\n[pypi_]: https://pypi.org/project/openapi-python-generator/\n[status]: https://pypi.org/project/openapi-python-generator/\n[python version]: https://pypi.org/project/openapi-python-generator\n[documentation]: https://marcomuellner.github.io/openapi-python-generator/\n[tests]: https://github.com/MarcoMuellner/openapi-python-generator/actions?workflow=Tests\n[codecov]: https://app.codecov.io/gh/MarcoMuellner/openapi-python-generator\n[pre-commit]: https://github.com/pre-commit/pre-commit\n[black]: https://github.com/psf/black\n\n![](logo.png)\n\n---\n__Documentation:__ [here][documentation]\n\n---\n\n## Features\n\n- __Ease of use__. Provide input, output and the library, and the generator will do the rest.\n- __Type safety and type hinting.__ __OpenAPI python generator__ makes heavy use of pydantic models to provide type-safe data structures.\n- __Support for multiple rest frameworks.__ __OpenAPI python generator__ currently supports the following:\n - [httpx](https://pypi.org/project/httpx/)\n - [requests](https://pypi.org/project/requests/)\n - [aiohttp](https://pypi.org/project/aiohttp/)\n- __Async and sync code generation support__, depending on the framework. It will automatically create both for frameworks that support both.\n- __Easily extendable using Jinja2 templates__. The code is designed to be easily extendable and should support even more languages and frameworks in the future.\n- __Fully tested__. Every generated code is automatically tested against the OpenAPI spec and we have 100% coverage.\n- __Usage as CLI or as library__.\n\n## Requirements\n\n- Python 3.7+\n\n## Installation\n\nYou can install _Openapi Python Generator_ via [pip] from [PyPI]:\n\n```console\n$ pip install openapi-python-generator\n```\n\n## Usage\n\nPlease see the [Quick start page] for details.\n\n## Roadmap\n\n- Support for all commonly used http libraries in the python ecosystem (~~requests~~, urllib, ...)\n- Support for multiple languages\n- Support for multiple authentication schemes\n- Support custom themes\n\n## Contributing\n\nContributions are very welcome.\nTo learn more, see the [Contributor Guide].\n\n## License\n\nDistributed under the terms of the [MIT license][license],\n_Openapi Python Generator_ is free and open source software.\n\n## Issues\n\nIf you encounter any problems,\nplease [file an issue] along with a detailed description.\n\n## Credits\n\nSpecial thanks to the peeps from [openapi-schema-pydantic](https://github.com/kuimono/openapi-schema-pydantic),\nwhich already did a lot of the legwork by providing a pydantic schema for the OpenAPI 3.0.0+ specification.\n\nThis project was generated from [@cjolowicz]'s [Hypermodern Python Cookiecutter] template.\n\n[@cjolowicz]: https://github.com/cjolowicz\n[pypi]: https://pypi.org/\n[hypermodern python cookiecutter]: https://github.com/cjolowicz/cookiecutter-hypermodern-python\n[file an issue]: https://github.com/MarcoMuellner/openapi-python-generator/issues\n[pip]: https://pip.pypa.io/\n\n<!-- github-only -->\n\n[license]: https://github.com/MarcoMuellner/openapi-python-generator/blob/main/LICENSE\n[contributor guide]: https://github.com/MarcoMuellner/openapi-python-generator/blob/main/CONTRIBUTING.md\n[Quick start page]: https://marcomuellner.github.io/openapi-python-generator/quick_start/\n",
38
38
  'author': 'Marco Müllner',
@@ -51,7 +51,7 @@ def type_converter( # noqa: C901
51
51
  :return: The converted type
52
52
  """
53
53
  # Handle Reference objects by converting them to type references
54
- if isinstance(schema, Reference):
54
+ if isinstance(schema, Reference30) or isinstance(schema, Reference31):
55
55
  import_type = common.normalize_symbol(schema.ref.split("/")[-1])
56
56
  if required:
57
57
  converted_type = import_type
@@ -85,7 +85,7 @@ def type_converter( # noqa: C901
85
85
  if schema.allOf is not None:
86
86
  conversions = []
87
87
  for sub_schema in schema.allOf:
88
- if isinstance(sub_schema, Schema):
88
+ if isinstance(sub_schema, Schema30) or isinstance(sub_schema, Schema31):
89
89
  conversions.append(type_converter(sub_schema, True))
90
90
  else:
91
91
  import_type = common.normalize_symbol(sub_schema.ref.split("/")[-1])
@@ -130,7 +130,7 @@ def type_converter( # noqa: C901
130
130
  used = used if used is not None else []
131
131
  conversions = []
132
132
  for sub_schema in used:
133
- if isinstance(sub_schema, Schema):
133
+ if isinstance(sub_schema, Schema30) or isinstance(sub_schema, Schema31):
134
134
  conversions.append(type_converter(sub_schema, True))
135
135
  else:
136
136
  import_type = common.normalize_symbol(sub_schema.ref.split("/")[-1])
@@ -191,14 +191,14 @@ def type_converter( # noqa: C901
191
191
  converted_type = pre_type + "bool" + post_type
192
192
  elif schema.type == "array" or str(schema.type) == "DataType.ARRAY":
193
193
  retVal = pre_type + "List["
194
- if isinstance(schema.items, Reference):
194
+ if isinstance(schema.items, Reference30) or isinstance(schema.items, Reference31):
195
195
  converted_reference = _generate_property_from_reference(
196
196
  model_name or "", "", schema.items, schema, required
197
197
  )
198
198
  import_types = converted_reference.type.import_types
199
199
  original_type = "array<" + converted_reference.type.original_type + ">"
200
200
  retVal += converted_reference.type.converted_type
201
- elif isinstance(schema.items, Schema):
201
+ elif isinstance(schema.items, Schema30) or isinstance(schema.items, Schema31):
202
202
  type_str = schema.items.type
203
203
  if hasattr(type_str, "value"):
204
204
  type_value = str(type_str.value) if type_str is not None else "unknown"
@@ -440,7 +440,7 @@ def generate_models(
440
440
  else {}
441
441
  )
442
442
  for prop_name, property in property_iterator:
443
- if isinstance(property, Reference):
443
+ if isinstance(property, Reference30) or isinstance(property, Reference31):
444
444
  conv_property = _generate_property_from_reference(
445
445
  name, prop_name, property, schema_or_reference
446
446
  )
@@ -61,7 +61,7 @@ def is_response_type(obj) -> bool:
61
61
 
62
62
 
63
63
  def create_media_type_for_reference(
64
- reference_obj: Response30 | Reference30 | Response31 | Reference31,
64
+ reference_obj: Union[Response30, Reference30 , Response31 , Reference31],
65
65
  ):
66
66
  """Create a MediaType wrapper for a reference object, using the correct version"""
67
67
  # Check which version the reference object belongs to
@@ -96,7 +96,7 @@ def generate_body_param(operation: Operation) -> Union[str, None]:
96
96
  if operation.requestBody is None:
97
97
  return None
98
98
  else:
99
- if isinstance(operation.requestBody, Reference):
99
+ if isinstance(operation.requestBody, Reference30) or isinstance(operation.requestBody, Reference31):
100
100
  return "data.dict()"
101
101
 
102
102
  if operation.requestBody.content is None:
@@ -156,18 +156,18 @@ def generate_params(operation: Operation) -> str:
156
156
  required = False
157
157
  param_name_cleaned = common.normalize_symbol(param.name)
158
158
 
159
- if isinstance(param.param_schema, Schema):
159
+ if isinstance(param.param_schema, Schema30) or isinstance(param.param_schema, Schema31):
160
160
  converted_result = (
161
161
  f"{param_name_cleaned} : {type_converter(param.param_schema, param.required).converted_type}"
162
162
  + ("" if param.required else " = None")
163
163
  )
164
164
  required = param.required
165
- elif isinstance(param.param_schema, Reference):
165
+ elif isinstance(param.param_schema, Reference30) or isinstance(param.param_schema, Reference31):
166
166
  converted_result = (
167
167
  f"{param_name_cleaned} : {param.param_schema.ref.split('/')[-1] }"
168
168
  + (
169
169
  ""
170
- if isinstance(param, Reference) or param.required
170
+ if isinstance(param, Reference30) or isinstance(param, Reference31) or param.required
171
171
  else " = None"
172
172
  )
173
173
  )