pydantic-openapi-generator 2.7.0__tar.gz → 2.8.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.
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/PKG-INFO +1 -1
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/pyproject.toml +1 -1
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/client_generator.py +5 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/async_client_httpx_pydantic_2.jinja2 +9 -4
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/sync_client_httpx_pydantic_2.jinja2 +9 -4
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/models.py +1 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/.gitignore +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/LICENSE +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/README.md +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/__init__.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/__main__.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/common.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/__init__.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/base_parameter.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/class_var_parameter.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/function_parameter.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/generator_config.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/kwarg_parameter.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/loader.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/parameter_source.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/parameter_union.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/config/utils.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/generate_data.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/__init__.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/__init__.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/common.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/exception_generator.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/generator.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/jinja_config.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/model_generator.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/alias_union.jinja2 +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/discriminator_enum.jinja2 +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/enum.jinja2 +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/http_exception.jinja2 +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/models.jinja2 +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/language_converters/python/templates/models_pydantic_2.jinja2 +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/parsers/__init__.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/parsers/openapi_30.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/parsers/openapi_31.py +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/py.typed +0 -0
- {pydantic_openapi_generator-2.7.0 → pydantic_openapi_generator-2.8.0}/src/pydantic_openapi_generator/version_detector.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pydantic-openapi-generator
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Summary: Openapi Python Generator
|
|
5
5
|
Project-URL: Homepage, https://github.com/mattcoulter7/pydantic-openapi-generator
|
|
6
6
|
Project-URL: Repository, https://github.com/mattcoulter7/pydantic-openapi-generator
|
|
@@ -807,6 +807,7 @@ def generate_clients(
|
|
|
807
807
|
query_params = generate_operation_parameters(op, generator_config, "query")
|
|
808
808
|
header_params = generate_operation_parameters(op, generator_config, "header")
|
|
809
809
|
all_params = path_params + query_params + header_params
|
|
810
|
+
call_kwargs = [param.code_name for param in all_params]
|
|
810
811
|
params = _method_signature(all_params, _body_signature_param(op) if body_param is not None else None)
|
|
811
812
|
path_name = _resolved_path_name(path_name, path_params)
|
|
812
813
|
|
|
@@ -816,12 +817,16 @@ def generate_clients(
|
|
|
816
817
|
norm_ph = common.normalize_symbol(ph)
|
|
817
818
|
if norm_ph not in existing_param_names and norm_ph:
|
|
818
819
|
params = f"{norm_ph}: Any, " + params
|
|
820
|
+
call_kwargs.insert(0, norm_ph)
|
|
821
|
+
if body_param is not None:
|
|
822
|
+
call_kwargs.append("data")
|
|
819
823
|
|
|
820
824
|
operation_id = generate_operation_id(op, http_operation, path_name)
|
|
821
825
|
return_type = generate_return_type(op)
|
|
822
826
|
|
|
823
827
|
so = ServiceOperation(
|
|
824
828
|
params=params,
|
|
829
|
+
call_kwargs=call_kwargs,
|
|
825
830
|
operation_id=operation_id,
|
|
826
831
|
path_params=path_params,
|
|
827
832
|
query_params=query_params,
|
|
@@ -27,7 +27,7 @@ class AsyncClient(BaseModel):
|
|
|
27
27
|
{{ field.code_name }}: {{ field.field_type_hint }}{% if field.field_default is not none %} = {{ field.field_default }}{% endif %}{{ "\n" }}
|
|
28
28
|
{% endfor %}
|
|
29
29
|
|
|
30
|
-
async def get_access_token(self) -> Optional[str]:
|
|
30
|
+
async def get_access_token(self, **kwargs: Any) -> Optional[str]:
|
|
31
31
|
{% if env_token_name is not none %}
|
|
32
32
|
try:
|
|
33
33
|
return os.environ["{{ env_token_name }}"]
|
|
@@ -48,7 +48,7 @@ class AsyncClient(BaseModel):
|
|
|
48
48
|
{% endif %}
|
|
49
49
|
|
|
50
50
|
{% for function in client_functions %}
|
|
51
|
-
async def {{ function.getter_name }}(self) -> {{ function.base_type_hint }}:
|
|
51
|
+
async def {{ function.getter_name }}(self, **kwargs: Any) -> {{ function.base_type_hint }}:
|
|
52
52
|
raise NotImplementedError
|
|
53
53
|
|
|
54
54
|
{% endfor %}
|
|
@@ -59,6 +59,11 @@ AsyncGenerator[str | {% if op.sse_data_handler and op.sse_data_handler.type %}{%
|
|
|
59
59
|
{{ op.return_type.return_type_hint or "None" }}
|
|
60
60
|
{%- endif -%}:
|
|
61
61
|
base_url = self.base_url
|
|
62
|
+
_request_kwargs = {
|
|
63
|
+
{% for kwarg in op.call_kwargs %}
|
|
64
|
+
"{{ kwarg }}": {{ kwarg }},
|
|
65
|
+
{% endfor %}
|
|
66
|
+
}
|
|
62
67
|
{% for param in op.path_params + op.query_params + op.header_params %}
|
|
63
68
|
{% if param.source == "ClassVar" %}
|
|
64
69
|
{% if param.is_secret %}
|
|
@@ -67,7 +72,7 @@ AsyncGenerator[str | {% if op.sse_data_handler and op.sse_data_handler.type %}{%
|
|
|
67
72
|
{{ param.local_name }} = {{ param.code_name }} if {{ param.code_name }} is not None else self.{{ param.code_name }}
|
|
68
73
|
{% endif %}
|
|
69
74
|
{% elif param.source == "Function" %}
|
|
70
|
-
{{ param.local_name }} = {{ param.code_name }} if {{ param.code_name }} is not None else await self.{{ param.getter_name }}()
|
|
75
|
+
{{ param.local_name }} = {{ param.code_name }} if {{ param.code_name }} is not None else await self.{{ param.getter_name }}(**_request_kwargs)
|
|
71
76
|
{% endif %}
|
|
72
77
|
{% endfor %}
|
|
73
78
|
path = f"{{ op.path_name }}"
|
|
@@ -89,7 +94,7 @@ AsyncGenerator[str | {% if op.sse_data_handler and op.sse_data_handler.type %}{%
|
|
|
89
94
|
}
|
|
90
95
|
headers = {k: v for (k, v) in headers.items() if v is not None}
|
|
91
96
|
|
|
92
|
-
_token = await self.get_access_token()
|
|
97
|
+
_token = await self.get_access_token(**_request_kwargs)
|
|
93
98
|
if _token:
|
|
94
99
|
headers["Authorization"] = f"Bearer {_token}"
|
|
95
100
|
|
|
@@ -27,7 +27,7 @@ class SyncClient(BaseModel):
|
|
|
27
27
|
{{ field.code_name }}: {{ field.field_type_hint }}{% if field.field_default is not none %} = {{ field.field_default }}{% endif %}{{ "\n" }}
|
|
28
28
|
{% endfor %}
|
|
29
29
|
|
|
30
|
-
def get_access_token(self) -> Optional[str]:
|
|
30
|
+
def get_access_token(self, **kwargs: Any) -> Optional[str]:
|
|
31
31
|
{% if env_token_name is not none %}
|
|
32
32
|
try:
|
|
33
33
|
return os.environ["{{ env_token_name }}"]
|
|
@@ -48,7 +48,7 @@ class SyncClient(BaseModel):
|
|
|
48
48
|
{% endif %}
|
|
49
49
|
|
|
50
50
|
{% for function in client_functions %}
|
|
51
|
-
def {{ function.getter_name }}(self) -> {{ function.base_type_hint }}:
|
|
51
|
+
def {{ function.getter_name }}(self, **kwargs: Any) -> {{ function.base_type_hint }}:
|
|
52
52
|
raise NotImplementedError
|
|
53
53
|
|
|
54
54
|
{% endfor %}
|
|
@@ -59,6 +59,11 @@ Generator[str | {% if op.sse_data_handler and op.sse_data_handler.type %}{% if o
|
|
|
59
59
|
{{ op.return_type.return_type_hint or "None" }}
|
|
60
60
|
{%- endif -%}:
|
|
61
61
|
base_url = self.base_url
|
|
62
|
+
_request_kwargs = {
|
|
63
|
+
{% for kwarg in op.call_kwargs %}
|
|
64
|
+
"{{ kwarg }}": {{ kwarg }},
|
|
65
|
+
{% endfor %}
|
|
66
|
+
}
|
|
62
67
|
{% for param in op.path_params + op.query_params + op.header_params %}
|
|
63
68
|
{% if param.source == "ClassVar" %}
|
|
64
69
|
{% if param.is_secret %}
|
|
@@ -67,7 +72,7 @@ Generator[str | {% if op.sse_data_handler and op.sse_data_handler.type %}{% if o
|
|
|
67
72
|
{{ param.local_name }} = {{ param.code_name }} if {{ param.code_name }} is not None else self.{{ param.code_name }}
|
|
68
73
|
{% endif %}
|
|
69
74
|
{% elif param.source == "Function" %}
|
|
70
|
-
{{ param.local_name }} = {{ param.code_name }} if {{ param.code_name }} is not None else self.{{ param.getter_name }}()
|
|
75
|
+
{{ param.local_name }} = {{ param.code_name }} if {{ param.code_name }} is not None else self.{{ param.getter_name }}(**_request_kwargs)
|
|
71
76
|
{% endif %}
|
|
72
77
|
{% endfor %}
|
|
73
78
|
path = f"{{ op.path_name }}"
|
|
@@ -89,7 +94,7 @@ Generator[str | {% if op.sse_data_handler and op.sse_data_handler.type %}{% if o
|
|
|
89
94
|
}
|
|
90
95
|
headers = {k: v for (k, v) in headers.items() if v is not None}
|
|
91
96
|
|
|
92
|
-
_token = self.get_access_token()
|
|
97
|
+
_token = self.get_access_token(**_request_kwargs)
|
|
93
98
|
if _token:
|
|
94
99
|
headers["Authorization"] = f"Bearer {_token}"
|
|
95
100
|
|
|
@@ -95,6 +95,7 @@ class GeneratedParameter(BaseModel):
|
|
|
95
95
|
|
|
96
96
|
class ServiceOperation(BaseModel):
|
|
97
97
|
params: str
|
|
98
|
+
call_kwargs: List[str] = Field(default_factory=list)
|
|
98
99
|
operation_id: str
|
|
99
100
|
path_params: List[GeneratedParameter] = Field(default_factory=list)
|
|
100
101
|
query_params: List[GeneratedParameter]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|