forked from loafle/openapi-generator-original
[python-fastapi]Add an alias keyword parameter for Query parameter (#17111)
* add alias to endpoint_definition * regenerate source code
This commit is contained in:
parent
9970c06f8c
commit
baaf759440
@ -1 +1 @@
|
|||||||
{{#isPathParam}}{{baseName}}{{/isPathParam}}{{^isPathParam}}{{paramName}}{{/isPathParam}}: {{>param_type}} = {{#isPathParam}}Path{{/isPathParam}}{{#isHeaderParam}}Header{{/isHeaderParam}}{{#isFormParam}}Form{{/isFormParam}}{{#isQueryParam}}Query{{/isQueryParam}}{{#isCookieParam}}Cookie{{/isCookieParam}}{{#isBodyParam}}Body{{/isBodyParam}}({{&defaultValue}}{{^defaultValue}}None{{/defaultValue}}, description="{{description}}"{{#isLong}}{{#minimum}}, ge={{.}}{{/minimum}}{{#maximum}}, le={{.}}{{/maximum}}{{/isLong}}{{#isInteger}}{{#minimum}}, ge={{.}}{{/minimum}}{{#maximum}}, le={{.}}{{/maximum}}{{/isInteger}}{{#pattern}}, regex=r"{{.}}"{{/pattern}}{{#minLength}}, min_length={{.}}{{/minLength}}{{#maxLength}}, max_length={{.}}{{/maxLength}})
|
{{#isPathParam}}{{baseName}}{{/isPathParam}}{{^isPathParam}}{{paramName}}{{/isPathParam}}: {{>param_type}} = {{#isPathParam}}Path{{/isPathParam}}{{#isHeaderParam}}Header{{/isHeaderParam}}{{#isFormParam}}Form{{/isFormParam}}{{#isQueryParam}}Query{{/isQueryParam}}{{#isCookieParam}}Cookie{{/isCookieParam}}{{#isBodyParam}}Body{{/isBodyParam}}({{&defaultValue}}{{^defaultValue}}None{{/defaultValue}}, description="{{description}}"{{#isQueryParam}}, alias="{{baseName}}"{{/isQueryParam}}{{#isLong}}{{#minimum}}, ge={{.}}{{/minimum}}{{#maximum}}, le={{.}}{{/maximum}}{{/isLong}}{{#isInteger}}{{#minimum}}, ge={{.}}{{/minimum}}{{#maximum}}, le={{.}}{{/maximum}}{{/isInteger}}{{#pattern}}, regex=r"{{.}}"{{/pattern}}{{#minLength}}, min_length={{.}}{{/minLength}}{{#maxLength}}, max_length={{.}}{{/maxLength}})
|
@ -577,13 +577,13 @@ paths:
|
|||||||
description: ''
|
description: ''
|
||||||
operationId: fake_query_param_default
|
operationId: fake_query_param_default
|
||||||
parameters:
|
parameters:
|
||||||
- name: has_default
|
- name: hasDefault
|
||||||
in: query
|
in: query
|
||||||
description: has default value
|
description: has default value
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: Hello World
|
default: Hello World
|
||||||
- name: no_default
|
- name: noDefault
|
||||||
in: query
|
in: query
|
||||||
description: no default value
|
description: no default value
|
||||||
schema:
|
schema:
|
||||||
|
@ -590,7 +590,7 @@ paths:
|
|||||||
- description: has default value
|
- description: has default value
|
||||||
explode: true
|
explode: true
|
||||||
in: query
|
in: query
|
||||||
name: has_default
|
name: hasDefault
|
||||||
required: false
|
required: false
|
||||||
schema:
|
schema:
|
||||||
default: Hello World
|
default: Hello World
|
||||||
@ -599,7 +599,7 @@ paths:
|
|||||||
- description: no default value
|
- description: no default value
|
||||||
explode: true
|
explode: true
|
||||||
in: query
|
in: query
|
||||||
name: no_default
|
name: noDefault
|
||||||
required: false
|
required: false
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
|
@ -42,8 +42,8 @@ for _, name, _ in pkgutil.iter_modules(ns_pkg.__path__, ns_pkg.__name__ + "."):
|
|||||||
response_model_by_alias=True,
|
response_model_by_alias=True,
|
||||||
)
|
)
|
||||||
async def fake_query_param_default(
|
async def fake_query_param_default(
|
||||||
has_default: str = Query('Hello World', description="has default value"),
|
has_default: str = Query('Hello World', description="has default value", alias="hasDefault"),
|
||||||
no_default: str = Query(None, description="no default value"),
|
no_default: str = Query(None, description="no default value", alias="noDefault"),
|
||||||
) -> None:
|
) -> None:
|
||||||
""""""
|
""""""
|
||||||
return BaseFakeApi.subclasses[0]().fake_query_param_default(has_default, no_default)
|
return BaseFakeApi.subclasses[0]().fake_query_param_default(has_default, no_default)
|
||||||
|
@ -84,7 +84,7 @@ async def delete_pet(
|
|||||||
response_model_by_alias=True,
|
response_model_by_alias=True,
|
||||||
)
|
)
|
||||||
async def find_pets_by_status(
|
async def find_pets_by_status(
|
||||||
status: List[str] = Query(None, description="Status values that need to be considered for filter"),
|
status: List[str] = Query(None, description="Status values that need to be considered for filter", alias="status"),
|
||||||
token_petstore_auth: TokenModel = Security(
|
token_petstore_auth: TokenModel = Security(
|
||||||
get_token_petstore_auth, scopes=["read:pets"]
|
get_token_petstore_auth, scopes=["read:pets"]
|
||||||
),
|
),
|
||||||
@ -104,7 +104,7 @@ async def find_pets_by_status(
|
|||||||
response_model_by_alias=True,
|
response_model_by_alias=True,
|
||||||
)
|
)
|
||||||
async def find_pets_by_tags(
|
async def find_pets_by_tags(
|
||||||
tags: List[str] = Query(None, description="Tags to filter by"),
|
tags: List[str] = Query(None, description="Tags to filter by", alias="tags"),
|
||||||
token_petstore_auth: TokenModel = Security(
|
token_petstore_auth: TokenModel = Security(
|
||||||
get_token_petstore_auth, scopes=["read:pets"]
|
get_token_petstore_auth, scopes=["read:pets"]
|
||||||
),
|
),
|
||||||
|
@ -138,8 +138,8 @@ async def get_user_by_name(
|
|||||||
response_model_by_alias=True,
|
response_model_by_alias=True,
|
||||||
)
|
)
|
||||||
async def login_user(
|
async def login_user(
|
||||||
username: str = Query(None, description="The user name for login", regex=r"/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/"),
|
username: str = Query(None, description="The user name for login", alias="username", regex=r"/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/"),
|
||||||
password: str = Query(None, description="The password for login in clear text"),
|
password: str = Query(None, description="The password for login in clear text", alias="password"),
|
||||||
) -> str:
|
) -> str:
|
||||||
""""""
|
""""""
|
||||||
return BaseUserApi.subclasses[0]().login_user(username, password)
|
return BaseUserApi.subclasses[0]().login_user(username, password)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user