forked from loafle/openapi-generator-original
[Python] add float to reserved word list (#16689)
* add float as reserved world * clean up * update samples * Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java Co-authored-by: Jonathan Ballet <jon@multani.info> * update doc * uncomment test --------- Co-authored-by: Jonathan Ballet <jon@multani.info>
This commit is contained in:
@@ -1120,7 +1120,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **test_endpoint_parameters**
|
||||
> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback)
|
||||
> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, var_float=var_float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback)
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
@@ -1164,7 +1164,7 @@ async with petstore_api.ApiClient(configuration) as api_client:
|
||||
integer = 56 # int | None (optional)
|
||||
int32 = 56 # int | None (optional)
|
||||
int64 = 56 # int | None (optional)
|
||||
float = 3.4 # float | None (optional)
|
||||
var_float = 3.4 # float | None (optional)
|
||||
string = 'string_example' # str | None (optional)
|
||||
binary = None # bytearray | None (optional)
|
||||
byte_with_max_length = None # bytearray | None (optional)
|
||||
@@ -1175,7 +1175,7 @@ async with petstore_api.ApiClient(configuration) as api_client:
|
||||
|
||||
try:
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
await api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback)
|
||||
await api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, var_float=var_float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback)
|
||||
except Exception as e:
|
||||
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
|
||||
```
|
||||
@@ -1193,7 +1193,7 @@ Name | Type | Description | Notes
|
||||
**integer** | **int**| None | [optional]
|
||||
**int32** | **int**| None | [optional]
|
||||
**int64** | **int**| None | [optional]
|
||||
**float** | **float**| None | [optional]
|
||||
**var_float** | **float**| None | [optional]
|
||||
**string** | **str**| None | [optional]
|
||||
**binary** | **bytearray**| None | [optional]
|
||||
**byte_with_max_length** | **bytearray**| None | [optional]
|
||||
|
||||
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
|
||||
**int32** | **int** | | [optional]
|
||||
**int64** | **int** | | [optional]
|
||||
**number** | **float** | |
|
||||
**var_float** | **float** | | [optional]
|
||||
**double** | **float** | | [optional]
|
||||
**decimal** | **decimal.Decimal** | | [optional]
|
||||
**string** | **str** | | [optional]
|
||||
|
||||
@@ -2079,7 +2079,7 @@ class FakeApi:
|
||||
_request_auth=_params.get('_request_auth'))
|
||||
|
||||
@validate_call
|
||||
async def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
|
||||
async def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, var_float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
|
||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||
@@ -2098,8 +2098,8 @@ class FakeApi:
|
||||
:type int32: int
|
||||
:param int64: None
|
||||
:type int64: int
|
||||
:param float: None
|
||||
:type float: float
|
||||
:param var_float: None
|
||||
:type var_float: float
|
||||
:param string: None
|
||||
:type string: str
|
||||
:param binary: None
|
||||
@@ -2127,10 +2127,10 @@ class FakeApi:
|
||||
if '_preload_content' in kwargs:
|
||||
message = "Error! Please call the test_endpoint_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
|
||||
raise ValueError(message)
|
||||
return await self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
|
||||
return await self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, var_float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
|
||||
|
||||
@validate_call
|
||||
async def test_endpoint_parameters_with_http_info(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
||||
async def test_endpoint_parameters_with_http_info(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, var_float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501
|
||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||
@@ -2149,8 +2149,8 @@ class FakeApi:
|
||||
:type int32: int
|
||||
:param int64: None
|
||||
:type int64: int
|
||||
:param float: None
|
||||
:type float: float
|
||||
:param var_float: None
|
||||
:type var_float: float
|
||||
:param string: None
|
||||
:type string: str
|
||||
:param binary: None
|
||||
@@ -2198,7 +2198,7 @@ class FakeApi:
|
||||
'integer',
|
||||
'int32',
|
||||
'int64',
|
||||
'float',
|
||||
'var_float',
|
||||
'string',
|
||||
'binary',
|
||||
'byte_with_max_length',
|
||||
@@ -2252,8 +2252,8 @@ class FakeApi:
|
||||
if _params['number'] is not None:
|
||||
_form_params.append(('number', _params['number']))
|
||||
|
||||
if _params['float'] is not None:
|
||||
_form_params.append(('float', _params['float']))
|
||||
if _params['var_float'] is not None:
|
||||
_form_params.append(('float', _params['var_float']))
|
||||
|
||||
if _params['double'] is not None:
|
||||
_form_params.append(('double', _params['double']))
|
||||
|
||||
@@ -32,6 +32,7 @@ class FormatTest(BaseModel):
|
||||
int32: Optional[Annotated[int, Field(le=200, strict=True, ge=20)]] = None
|
||||
int64: Optional[StrictInt] = None
|
||||
number: Annotated[float, Field(le=543.2, ge=32.1)]
|
||||
var_float: Optional[Annotated[float, Field(le=987.6, ge=54.3)]] = Field(default=None, alias="float")
|
||||
double: Optional[Annotated[float, Field(le=123.4, ge=67.8)]] = None
|
||||
decimal: Optional[Decimal] = None
|
||||
string: Optional[Annotated[str, Field(strict=True)]] = None
|
||||
@@ -44,7 +45,7 @@ class FormatTest(BaseModel):
|
||||
password: Annotated[str, Field(min_length=10, strict=True, max_length=64)]
|
||||
pattern_with_digits: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string that is a 10 digit number. Can have leading zeros.")
|
||||
pattern_with_digits_and_delimiter: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.")
|
||||
__properties: ClassVar[List[str]] = ["integer", "int32", "int64", "number", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"]
|
||||
__properties: ClassVar[List[str]] = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"]
|
||||
|
||||
@field_validator('string')
|
||||
def string_validate_regular_expression(cls, value):
|
||||
@@ -128,6 +129,7 @@ class FormatTest(BaseModel):
|
||||
"int32": obj.get("int32"),
|
||||
"int64": obj.get("int64"),
|
||||
"number": obj.get("number"),
|
||||
"float": obj.get("float"),
|
||||
"double": obj.get("double"),
|
||||
"decimal": obj.get("decimal"),
|
||||
"string": obj.get("string"),
|
||||
|
||||
Reference in New Issue
Block a user