Skip to content

Commit 3da8a42

Browse files
committed
Added support for path parameters
Closes #10
1 parent 301ec16 commit 3da8a42

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

openapi_python_client/templates/endpoint_module.pyi

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,29 @@ def {{ endpoint.name }}(
1919
{% else %}
2020
client: Client,
2121
{% endif %}
22+
{# path parameters #}
23+
{% for parameter in endpoint.path_parameters %}
24+
{{ parameter.to_string() }},
25+
{% endfor %}
2226
{# Form data if any #}
2327
{% if endpoint.form_body_reference %}
2428
form_data: {{ endpoint.form_body_reference.class_name }},
2529
{% endif %}
26-
{# Form data if any #}
30+
{# JSON body if any #}
2731
{% if endpoint.json_body %}
2832
json_body: {{ endpoint.json_body.get_type_string() }},
2933
{% endif %}
3034
{# query parameters #}
31-
{% if endpoint.query_parameters %}
3235
{% for parameter in endpoint.query_parameters %}
3336
{{ parameter.to_string() }},
3437
{% endfor %}
35-
{% endif %}
3638
) -> Union[
3739
{% for response in endpoint.responses %}
3840
{{ response.return_string() }},
3941
{% endfor %}
4042
]:
4143
""" {{ endpoint.description }} """
42-
url = client.base_url + "{{ endpoint.path }}"
44+
url = f"{client.base_url}{{ endpoint.path }}"
4345

4446
{% if endpoint.query_parameters %}
4547
params = {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from enum import Enum
22

3-
class {{ enum.reference.class_name }}(Enum):
3+
class {{ enum.reference.class_name }}(str, Enum):
44
{% for key, value in enum.values.items() %}
55
{{ key }} = "{{ value }}"
66
{% endfor %}

0 commit comments

Comments
 (0)