[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:
William Cheng
2023-10-01 20:41:54 +08:00
committed by GitHub
parent 3fcf5584c6
commit ce4b2fe7bd
27 changed files with 94 additions and 759 deletions

View File

@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**number** | **float** | | [optional]
**var_float** | **float** | | [optional]
**double** | **float** | | [optional]
## Example

View File

@@ -29,8 +29,9 @@ class NumberPropertiesOnly(BaseModel):
NumberPropertiesOnly
"""
number: Optional[Union[StrictFloat, StrictInt]] = None
var_float: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="float")
double: Optional[Union[Annotated[float, Field(le=50.2, strict=True, ge=0.8)], Annotated[int, Field(le=50, strict=True, ge=1)]]] = None
__properties: ClassVar[List[str]] = ["number", "double"]
__properties: ClassVar[List[str]] = ["number", "float", "double"]
model_config = {
"populate_by_name": True,
@@ -71,6 +72,7 @@ class NumberPropertiesOnly(BaseModel):
_obj = NumberPropertiesOnly.model_validate({
"number": obj.get("number"),
"float": obj.get("float"),
"double": obj.get("double")
})
return _obj