forked from loafle/openapi-generator-original
[BUG] [Python] Fix autoset constants Python code for default query string value (#19138)
* _query_params is list, not dict * Add test
This commit is contained in:
parent
aaeed0f5bd
commit
aa7c62abb7
@ -176,7 +176,7 @@ class {{classname}}:
|
|||||||
{{#constantParams}}
|
{{#constantParams}}
|
||||||
{{#isQueryParam}}
|
{{#isQueryParam}}
|
||||||
# Set client side default value of Query Param "{{baseName}}".
|
# Set client side default value of Query Param "{{baseName}}".
|
||||||
_query_params['{{baseName}}'] = {{#_enum}}'{{{.}}}'{{/_enum}}
|
_query_params.append(('{{baseName}}', {{#_enum}}'{{{.}}}'{{/_enum}}))
|
||||||
{{/isQueryParam}}
|
{{/isQueryParam}}
|
||||||
{{#isHeaderParam}}
|
{{#isHeaderParam}}
|
||||||
# Set client side default value of Header Param "{{baseName}}".
|
# Set client side default value of Header Param "{{baseName}}".
|
||||||
|
@ -528,5 +528,6 @@ public class PythonClientCodegenTest {
|
|||||||
.get(Paths.get(output.getAbsolutePath(), "openapi_client", "api", "hello_example_api.py").toString());
|
.get(Paths.get(output.getAbsolutePath(), "openapi_client", "api", "hello_example_api.py").toString());
|
||||||
assertNotNull(apiFile);
|
assertNotNull(apiFile);
|
||||||
assertFileContains(apiFile.toPath(), "_header_params['X-CUSTOM_CONSTANT_HEADER'] = 'CONSTANT_VALUE'");
|
assertFileContains(apiFile.toPath(), "_header_params['X-CUSTOM_CONSTANT_HEADER'] = 'CONSTANT_VALUE'");
|
||||||
|
assertFileContains(apiFile.toPath(), "_query_params.append(('CONSTANT_QUERY_STRING_KEY', 'CONSTANT_QUERY_STRING_VALUE'))");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,13 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- CONSTANT_VALUE
|
- CONSTANT_VALUE
|
||||||
|
- name: CONSTANT_QUERY_STRING_KEY
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- CONSTANT_QUERY_STRING_VALUE
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
@ -39,4 +46,4 @@ components:
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
message:
|
message:
|
||||||
type: string
|
type: string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user