forked from loafle/openapi-generator-original
Bugfixes for python-nextgen (#14334)
* Fix swapped operators Signed-off-by: Tom Hörberg <tom@hoerberg.de> * add conversion to support non-string params Signed-off-by: Tom Hörberg <tom@hoerberg.de> * Provide better fix for nonstring url param values Signed-off-by: Tom Hörberg <tom@hoerberg.de> * Updated python-nextgen sample files Signed-off-by: Tom Hörberg <tom@hoerberg.de> Signed-off-by: Tom Hörberg <tom@hoerberg.de>
This commit is contained in:
parent
be93d1f839
commit
2236cebe02
@ -457,16 +457,16 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
|
|||||||
fieldCustomization.add("strict=True");
|
fieldCustomization.add("strict=True");
|
||||||
if (cp.getMaximum() != null) {
|
if (cp.getMaximum() != null) {
|
||||||
if (cp.getExclusiveMaximum()) {
|
if (cp.getExclusiveMaximum()) {
|
||||||
fieldCustomization.add("gt=" + cp.getMaximum());
|
fieldCustomization.add("lt=" + cp.getMaximum());
|
||||||
} else {
|
} else {
|
||||||
fieldCustomization.add("ge=" + cp.getMaximum());
|
fieldCustomization.add("le=" + cp.getMaximum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cp.getMinimum() != null) {
|
if (cp.getMinimum() != null) {
|
||||||
if (cp.getExclusiveMinimum()) {
|
if (cp.getExclusiveMinimum()) {
|
||||||
fieldCustomization.add("lt=" + cp.getMinimum());
|
fieldCustomization.add("gt=" + cp.getMinimum());
|
||||||
} else {
|
} else {
|
||||||
fieldCustomization.add("le=" + cp.getMinimum());
|
fieldCustomization.add("ge=" + cp.getMinimum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cp.getMultipleOf() != null) {
|
if (cp.getMultipleOf() != null) {
|
||||||
|
@ -545,6 +545,11 @@ class ApiClient(object):
|
|||||||
if collection_formats is None:
|
if collection_formats is None:
|
||||||
collection_formats = {}
|
collection_formats = {}
|
||||||
for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
|
for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
|
||||||
|
if isinstance(v, (int, float)):
|
||||||
|
v = str(v)
|
||||||
|
if isinstance(v, bool):
|
||||||
|
v = str(v).lower()
|
||||||
|
|
||||||
if k in collection_formats:
|
if k in collection_formats:
|
||||||
collection_format = collection_formats[k]
|
collection_format = collection_formats[k]
|
||||||
if collection_format == 'multi':
|
if collection_format == 'multi':
|
||||||
|
@ -1678,7 +1678,7 @@ class FakeApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@validate_arguments
|
@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, ge=100, le=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, ge=200, le=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(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
|
||||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # 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
|
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
|
@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, ge=100, le=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, ge=200, le=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(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
|
||||||
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
"""Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
|
||||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
|
||||||
|
@ -316,7 +316,7 @@ class StoreApi(object):
|
|||||||
_request_auth=_params.get('_request_auth'))
|
_request_auth=_params.get('_request_auth'))
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def get_order_by_id(self, order_id : Annotated[conint(strict=True, ge=5, le=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> Order: # noqa: E501
|
def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> Order: # noqa: E501
|
||||||
"""Find purchase order by ID # noqa: E501
|
"""Find purchase order by ID # noqa: E501
|
||||||
|
|
||||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
||||||
@ -347,7 +347,7 @@ class StoreApi(object):
|
|||||||
return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501
|
return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501
|
||||||
|
|
||||||
@validate_arguments
|
@validate_arguments
|
||||||
def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, ge=5, le=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs): # noqa: E501
|
def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs): # noqa: E501
|
||||||
"""Find purchase order by ID # noqa: E501
|
"""Find purchase order by ID # noqa: E501
|
||||||
|
|
||||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
||||||
|
@ -521,6 +521,11 @@ class ApiClient(object):
|
|||||||
if collection_formats is None:
|
if collection_formats is None:
|
||||||
collection_formats = {}
|
collection_formats = {}
|
||||||
for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
|
for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
|
||||||
|
if isinstance(v, (int, float)):
|
||||||
|
v = str(v)
|
||||||
|
if isinstance(v, bool):
|
||||||
|
v = str(v).lower()
|
||||||
|
|
||||||
if k in collection_formats:
|
if k in collection_formats:
|
||||||
collection_format = collection_formats[k]
|
collection_format = collection_formats[k]
|
||||||
if collection_format == 'multi':
|
if collection_format == 'multi':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user