optionally support float strict type (#14618)

This commit is contained in:
William Cheng 2023-02-12 19:44:18 +08:00 committed by GitHub
parent d7a2e4a293
commit 72c02e4bc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 76 additions and 40 deletions

View File

@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/python-nextgen
library: asyncio
additionalProperties:
packageName: petstore_api
floatStrictType: false

View File

@ -20,6 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|floatStrictType|Use strict type for float, i.e. StrictFloat or confloat(strict=true, ...)| |true|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3| |urllib3|

View File

@ -46,13 +46,14 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
public static final String PACKAGE_URL = "packageUrl";
public static final String DEFAULT_LIBRARY = "urllib3";
public static final String RECURSION_LIMIT = "recursionLimit";
public static final String PYTHON_ATTR_NONE_IF_UNSET = "pythonAttrNoneIfUnset";
public static final String FLOAT_STRICT_TYPE = "floatStrictType";
protected String packageUrl;
protected String apiDocPath = "docs" + File.separator;
protected String modelDocPath = "docs" + File.separator;
protected boolean hasModelsToImport = Boolean.FALSE;
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
protected boolean floatStrictType = true;
protected Map<Character, String> regexModifiers;
@ -164,6 +165,8 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC)
.defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(RECURSION_LIMIT, "Set the recursion limit. If not set, use the system default value."));
cliOptions.add(new CliOption(FLOAT_STRICT_TYPE, "Use strict type for float, i.e. StrictFloat or confloat(strict=true, ...)")
.defaultValue(Boolean.TRUE.toString()));
supportedLibraries.put("urllib3", "urllib3-based client");
supportedLibraries.put("asyncio", "asyncio-based client");
@ -259,6 +262,10 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, useOneOfDiscriminatorLookup);
}
if (additionalProperties.containsKey(FLOAT_STRICT_TYPE)) {
setFloatStrictType(convertPropertyToBooleanAndWriteBack(FLOAT_STRICT_TYPE));
}
String modelPath = packagePath() + File.separatorChar + modelPackage.replace('.', File.separatorChar);
String apiPath = packagePath() + File.separatorChar + apiPackage.replace('.', File.separatorChar);
@ -424,7 +431,6 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
if (cp.hasValidation) {
List<String> fieldCustomization = new ArrayList<>();
// e.g. confloat(ge=10, le=100, strict=True)
fieldCustomization.add("strict=True");
if (cp.getMaximum() != null) {
if (cp.getExclusiveMaximum()) {
fieldCustomization.add("gt=" + cp.getMaximum());
@ -443,12 +449,20 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
fieldCustomization.add("multiple_of=" + cp.getMultipleOf());
}
if (floatStrictType) {
fieldCustomization.add("strict=True");
}
pydanticImports.add("confloat");
return String.format(Locale.ROOT, "%s(%s)", "confloat",
StringUtils.join(fieldCustomization, ", "));
} else {
if (floatStrictType) {
pydanticImports.add("StrictFloat");
return "StrictFloat";
} else {
return "float";
}
}
} else if (cp.isInteger || cp.isLong || cp.isShort || cp.isUnboundedInteger) {
if (cp.hasValidation) {
@ -645,7 +659,6 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
if (cp.hasValidation) {
List<String> fieldCustomization = new ArrayList<>();
// e.g. confloat(ge=10, le=100, strict=True)
fieldCustomization.add("strict=True");
if (cp.getMaximum() != null) {
if (cp.getExclusiveMaximum()) {
fieldCustomization.add("lt=" + cp.getMaximum());
@ -664,12 +677,20 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
fieldCustomization.add("multiple_of=" + cp.getMultipleOf());
}
if (floatStrictType) {
fieldCustomization.add("strict=True");
}
pydanticImports.add("confloat");
return String.format(Locale.ROOT, "%s(%s)", "confloat",
StringUtils.join(fieldCustomization, ", "));
} else {
if (floatStrictType) {
pydanticImports.add("StrictFloat");
return "StrictFloat";
} else {
return "float";
}
}
} else if (cp.isInteger || cp.isLong || cp.isShort || cp.isUnboundedInteger) {
if (cp.hasValidation) {
@ -1316,4 +1337,8 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
}
return "var_" + name;
}
public void setFloatStrictType(boolean floatStrictType) {
this.floatStrictType = floatStrictType;
}
}

View File

@ -1521,7 +1521,6 @@ components:
type: object
required:
- number
- byte
- date
- password
properties:

View File

@ -12,7 +12,7 @@ Name | Type | Description | Notes
**double** | **float** | | [optional]
**decimal** | **decimal.Decimal** | | [optional]
**string** | **str** | | [optional]
**byte** | **str** | |
**byte** | **str** | | [optional]
**binary** | **str** | | [optional]
**var_date** | **date** | |
**date_time** | **datetime** | | [optional]

View File

@ -19,7 +19,7 @@ from typing_extensions import Annotated
from datetime import date, datetime
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, confloat, conint, constr, validator
from pydantic import Field, StrictBool, StrictInt, StrictStr, confloat, conint, constr, validator
from typing import Dict, List, Optional
@ -641,7 +641,7 @@ class FakeApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def fake_outer_number_serialize(self, body : Annotated[Optional[StrictFloat], Field(description="Input number as post body")] = None, **kwargs) -> float: # noqa: E501
def fake_outer_number_serialize(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs) -> float: # noqa: E501
"""fake_outer_number_serialize # noqa: E501
Test serialization of outer number types # noqa: E501
@ -672,7 +672,7 @@ class FakeApi(object):
return self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[StrictFloat], Field(description="Input number as post body")] = None, **kwargs): # noqa: E501
def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs): # noqa: E501
"""fake_outer_number_serialize # noqa: E501
Test serialization of outer number types # noqa: E501
@ -1678,7 +1678,7 @@ class FakeApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_endpoint_parameters(self, number : Annotated[confloat(strict=True, ge=543.2, le=32.1), Field(..., description="None")], double : Annotated[confloat(strict=True, ge=123.4, le=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(strict=True, ge=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
def test_endpoint_parameters(self, number : Annotated[confloat(ge=543.2, le=32.1), Field(..., description="None")], double : Annotated[confloat(ge=123.4, le=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(ge=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], 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
@ -1735,7 +1735,7 @@ class FakeApi(object):
return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
@validate_arguments
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(strict=True, ge=543.2, le=32.1), Field(..., description="None")], double : Annotated[confloat(strict=True, ge=123.4, le=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(strict=True, ge=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(ge=543.2, le=32.1), Field(..., description="None")], double : Annotated[confloat(ge=123.4, le=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(ge=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictFloat
from pydantic import BaseModel, Field
class ArrayOfArrayOfNumberOnly(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
Do not edit the class manually.
"""
array_array_number: Optional[List[List[StrictFloat]]] = Field(None, alias="ArrayArrayNumber")
array_array_number: Optional[List[List[float]]] = Field(None, alias="ArrayArrayNumber")
__properties = ["ArrayArrayNumber"]
class Config:

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictFloat
from pydantic import BaseModel, Field
class ArrayOfNumberOnly(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class ArrayOfNumberOnly(BaseModel):
Do not edit the class manually.
"""
array_number: Optional[List[StrictFloat]] = Field(None, alias="ArrayNumber")
array_number: Optional[List[float]] = Field(None, alias="ArrayNumber")
__properties = ["ArrayNumber"]
class Config:

View File

@ -18,7 +18,7 @@ import json
from typing import Optional
from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator
from pydantic import BaseModel, Field, StrictInt, StrictStr, validator
from petstore_api.models.outer_enum import OuterEnum
from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue
from petstore_api.models.outer_enum_integer import OuterEnumInteger
@ -33,7 +33,7 @@ class EnumTest(BaseModel):
enum_string: Optional[StrictStr] = None
enum_string_required: StrictStr = ...
enum_integer: Optional[StrictInt] = None
enum_number: Optional[StrictFloat] = None
enum_number: Optional[float] = None
outer_enum: Optional[OuterEnum] = Field(None, alias="outerEnum")
outer_enum_integer: Optional[OuterEnumInteger] = Field(None, alias="outerEnumInteger")
outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(None, alias="outerEnumDefaultValue")

View File

@ -29,12 +29,12 @@ class FormatTest(BaseModel):
integer: Optional[conint(strict=True, le=100, ge=10)] = None
int32: Optional[conint(strict=True, le=200, ge=20)] = None
int64: Optional[StrictInt] = None
number: confloat(strict=True, le=543.2, ge=32.1) = ...
float: Optional[confloat(strict=True, le=987.6, ge=54.3)] = None
double: Optional[confloat(strict=True, le=123.4, ge=67.8)] = None
number: confloat(le=543.2, ge=32.1) = ...
float: Optional[confloat(le=987.6, ge=54.3)] = None
double: Optional[confloat(le=123.4, ge=67.8)] = None
decimal: Optional[condecimal()] = None
string: Optional[constr(strict=True)] = None
byte: StrictBytes = ...
byte: Optional[StrictBytes] = None
binary: Optional[StrictBytes] = None
var_date: date = Field(..., alias="date")
date_time: Optional[datetime] = Field(None, alias="dateTime")

View File

@ -18,7 +18,7 @@ import json
from datetime import date, datetime
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr
from pydantic import BaseModel, StrictBool, StrictInt, StrictStr
class NullableClass(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -28,7 +28,7 @@ class NullableClass(BaseModel):
"""
required_integer_prop: Optional[StrictInt] = ...
integer_prop: Optional[StrictInt] = None
number_prop: Optional[StrictFloat] = None
number_prop: Optional[float] = None
boolean_prop: Optional[StrictBool] = None
string_prop: Optional[StrictStr] = None
date_prop: Optional[date] = None

View File

@ -18,7 +18,7 @@ import json
from typing import Optional
from pydantic import BaseModel, Field, StrictFloat
from pydantic import BaseModel, Field
class NumberOnly(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class NumberOnly(BaseModel):
Do not edit the class manually.
"""
just_number: Optional[StrictFloat] = Field(None, alias="JustNumber")
just_number: Optional[float] = Field(None, alias="JustNumber")
__properties = ["JustNumber"]
class Config:

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictFloat, StrictStr
from pydantic import BaseModel, Field, StrictStr
from petstore_api.models.deprecated_object import DeprecatedObject
class ObjectWithDeprecatedFields(BaseModel):
@ -28,7 +28,7 @@ class ObjectWithDeprecatedFields(BaseModel):
Do not edit the class manually.
"""
uuid: Optional[StrictStr] = None
id: Optional[StrictFloat] = None
id: Optional[float] = None
deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef")
bars: Optional[List[StrictStr]] = None
__properties = ["uuid", "id", "deprecatedRef", "bars"]

View File

@ -18,7 +18,7 @@ import json
from typing import Optional
from pydantic import BaseModel, StrictBool, StrictFloat, StrictStr
from pydantic import BaseModel, StrictBool, StrictStr
class OuterComposite(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class OuterComposite(BaseModel):
Do not edit the class manually.
"""
my_number: Optional[StrictFloat] = None
my_number: Optional[float] = None
my_string: Optional[StrictStr] = None
my_boolean: Optional[StrictBool] = None
__properties = ["my_number", "my_string", "my_boolean"]

View File

@ -204,6 +204,16 @@ class ModelTests(unittest.TestCase):
self.assertEqual(d3.value, petstore_api.OuterEnumInteger.NUMBER_1)
self.assertEqual(d3.to_json(), '{"str_value": "delivered", "value": 1}')
def test_float_strict_type(self):
# assigning 123 to float shouldn't throw an exception
a = petstore_api.FormatTest(number=39.8, float=123, byte=bytes("string", 'utf-8'), date="2013-09-17", password="testing09876")
self.assertEqual(a.float, 123.0)
json_str = '{"number": 34.5, "float": "456", "date": "2013-12-08", "password": "empty1234567", "pattern_with_digits": "1234567890", "pattern_with_digits_and_delimiter": "image_123" , "string": "string"}'
# no exception thrown when assigning 456 (integer) to float type since strict is set to false
f = petstore_api.FormatTest.from_json(json_str)
self.assertEqual(f.float, 456.0)
def test_valdiator(self):
# test regular expression
a = petstore_api.FormatTest(number=123.45, byte=bytes("string", 'utf-8'), date="2013-09-17", password="testing09876")
@ -211,7 +221,7 @@ class ModelTests(unittest.TestCase):
a.pattern_with_digits_and_delimiter = "123"
self.assertTrue(False) # this line shouldn't execute
except ValueError as e:
self.assertTrue("must validate the regular expression /^image_\d{1,3}$/i" in str(e))
self.assertTrue(r"must validate the regular expression /^image_\d{1,3}$/i" in str(e))
a.pattern_with_digits_and_delimiter = "IMAGE_123"
self.assertEqual(a.pattern_with_digits_and_delimiter, "IMAGE_123")

View File

@ -12,7 +12,7 @@ Name | Type | Description | Notes
**double** | **float** | | [optional]
**decimal** | **decimal.Decimal** | | [optional]
**string** | **str** | | [optional]
**byte** | **str** | |
**byte** | **str** | | [optional]
**binary** | **str** | | [optional]
**var_date** | **date** | |
**date_time** | **datetime** | | [optional]

View File

@ -1678,7 +1678,7 @@ class FakeApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_endpoint_parameters(self, number : Annotated[confloat(strict=True, ge=543.2, le=32.1), Field(..., description="None")], double : Annotated[confloat(strict=True, ge=123.4, le=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(strict=True, ge=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501
def test_endpoint_parameters(self, number : Annotated[confloat(ge=543.2, le=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(ge=123.4, le=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(ge=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], 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
@ -1735,7 +1735,7 @@ class FakeApi(object):
return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, var_date, date_time, password, param_callback, **kwargs) # noqa: E501
@validate_arguments
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(strict=True, ge=543.2, le=32.1), Field(..., description="None")], double : Annotated[confloat(strict=True, ge=123.4, le=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(strict=True, ge=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(ge=543.2, le=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(ge=123.4, le=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[StrictStr, Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(ge=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[StrictStr], 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[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs): # noqa: E501
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501

View File

@ -29,12 +29,12 @@ class FormatTest(BaseModel):
integer: Optional[conint(strict=True, le=100, ge=10)] = None
int32: Optional[conint(strict=True, le=200, ge=20)] = None
int64: Optional[StrictInt] = None
number: confloat(strict=True, le=543.2, ge=32.1) = ...
float: Optional[confloat(strict=True, le=987.6, ge=54.3)] = None
double: Optional[confloat(strict=True, le=123.4, ge=67.8)] = None
number: confloat(le=543.2, ge=32.1, strict=True) = ...
float: Optional[confloat(le=987.6, ge=54.3, strict=True)] = None
double: Optional[confloat(le=123.4, ge=67.8, strict=True)] = None
decimal: Optional[condecimal()] = None
string: Optional[constr(strict=True)] = None
byte: StrictBytes = ...
byte: Optional[StrictBytes] = None
binary: Optional[StrictBytes] = None
var_date: date = Field(..., alias="date")
date_time: Optional[datetime] = Field(None, alias="dateTime")