File tree 3 files changed +17
-2
lines changed
3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 27
27
"snakecase" : utils .snake_case ,
28
28
"kebabcase" : utils .kebab_case ,
29
29
"pascalcase" : utils .pascal_case ,
30
+ "convert_endpoint_path" : utils .convert_endpoint_path ,
30
31
"any" : any ,
31
32
}
32
33
Original file line number Diff line number Diff line change @@ -29,9 +29,9 @@ def _get_kwargs(
29
29
_kwargs: Dict[str, Any] = {
30
30
"method": "{{ endpoint.method }}",
31
31
{% if endpoint .path_parameters %}
32
- "url": "{{ endpoint.path }}".format(
32
+ "url": "{{ endpoint | convert_endpoint_path }}".format(
33
33
{% - for parameter in endpoint .path_parameters -%}
34
- {{parameter.name }}={{parameter.python_name}},
34
+ {{parameter.python_name }}={{parameter.python_name}},
35
35
{% - endfor -%}
36
36
),
37
37
{% else %}
Original file line number Diff line number Diff line change @@ -118,3 +118,17 @@ def get_content_type(content_type: str) -> str | None:
118
118
return None
119
119
120
120
return parsed_content_type
121
+
122
+
123
+ def convert_endpoint_path (endpoint ) -> str :
124
+ """
125
+ Converts parameter names within the endpoint path to their python names.
126
+ """
127
+
128
+ endpoint_path_python_names = endpoint .path
129
+ for parameter in endpoint .path_parameters :
130
+ endpoint_path_python_names = endpoint_path_python_names .replace (
131
+ f'{{{ parameter .name } }}' ,
132
+ f'{{{ parameter .python_name } }}'
133
+ )
134
+ return endpoint_path_python_names
You can’t perform that action at this time.
0 commit comments