mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
[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:
@@ -5,6 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**number** | **float** | | [optional]
|
||||
**var_float** | **float** | | [optional]
|
||||
**double** | **float** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user