forked from loafle/openapi-generator-original
[Python-experimental] Don't mandate passing in required value as argument (#7424)
* [Python-experimental] Don't mandate passing in required value as argument * Remove usage of have_value * Address additional review comments * Fix tests according to the code change * Does not set None as value initial value, removes hasRequired tag usage, updates docstring Co-authored-by: Justin Black <justin.a.black@gmail.com>
This commit is contained in:
@@ -713,11 +713,11 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
|
||||
// 1. no default exists
|
||||
// schema does not contain default
|
||||
// cm.defaultValue unset, cm.hasRequired = true
|
||||
// 2. server has a default
|
||||
// 2. spec has a default
|
||||
// schema contains default
|
||||
// cm.defaultValue set, cm.hasRequired = true
|
||||
// cm.defaultValue set, cm.hasRequired = false
|
||||
// different value here to differentiate between use case 3 below
|
||||
// This defaultValue is used in the client docs only and is not sent to the server
|
||||
// This defaultValue is used when a consumer (client or server) lacks the input argument, defaultValue will be used
|
||||
// 3. only one value is allowed in an enum
|
||||
// schema does not contain default
|
||||
// cm.defaultValue set, cm.hasRequired = false
|
||||
@@ -728,7 +728,7 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
|
||||
cm.hasRequired = true;
|
||||
} else if (sc.getDefault() != null) {
|
||||
cm.defaultValue = defaultValue;
|
||||
cm.hasRequired = true;
|
||||
cm.hasRequired = false;
|
||||
} else if (defaultValue != null && cm.defaultValue == null) {
|
||||
cm.defaultValue = defaultValue;
|
||||
cm.hasRequired = false;
|
||||
|
||||
@@ -8,30 +8,37 @@
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self{{#hasRequired}}, value{{/hasRequired}}, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""{{classname}} - a model defined in OpenAPI
|
||||
|
||||
{{#hasRequired}}
|
||||
Args:
|
||||
value ({{{dataType}}}):{{#description}} {{description}}.{{/description}}{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}{{#allowableValues}}, must be one of [{{#enumVars}}{{{value}}}, {{/enumVars}}]{{/allowableValues}} # noqa: E501
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
args[0] ({{{dataType}}}):{{#description}} {{description}}.{{/description}}{{#defaultValue}} if omitted defaults to {{{defaultValue}}}{{/defaultValue}}{{#allowableValues}}, must be one of [{{#enumVars}}{{{value}}}, {{/enumVars}}]{{/allowableValues}} # noqa: E501
|
||||
|
||||
{{/hasRequired}}
|
||||
Keyword Args:
|
||||
{{^hasRequired}}
|
||||
value ({{{dataType}}}):{{#description}} {{description}}.{{/description}}{{#defaultValue}} defaults to {{{defaultValue}}}{{/defaultValue}}{{#allowableValues}}, must be one of [{{#enumVars}}{{{value}}}, {{/enumVars}}]{{/allowableValues}} # noqa: E501
|
||||
{{/hasRequired}}
|
||||
value ({{{dataType}}}):{{#description}} {{description}}.{{/description}}{{#defaultValue}} if omitted defaults to {{{defaultValue}}}{{/defaultValue}}{{#allowableValues}}, must be one of [{{#enumVars}}{{{value}}}, {{/enumVars}}]{{/allowableValues}} # noqa: E501
|
||||
{{> python-experimental/model_templates/docstring_init_required_kwargs }}
|
||||
"""
|
||||
|
||||
{{^hasRequired}}
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
{{#defaultValue}}
|
||||
else:
|
||||
value = {{{defaultValue}}}
|
||||
{{/hasRequired}}
|
||||
{{/defaultValue}}
|
||||
{{^defaultValue}}
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
{{/defaultValue}}
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -375,7 +375,7 @@ public class PythonClientExperimentalTest {
|
||||
|
||||
final CodegenModel hasDefaultModel = codegen.fromModel("hasDefaultModel", hasDefault);
|
||||
Assert.assertEquals(hasDefaultModel.defaultValue, "15.0");
|
||||
Assert.assertEquals(hasDefaultModel.hasRequired, true);
|
||||
Assert.assertEquals(hasDefaultModel.hasRequired, false);
|
||||
|
||||
final CodegenModel noDefaultEumLengthOneModel = codegen.fromModel("noDefaultEumLengthOneModel", noDefaultEumLengthOne);
|
||||
Assert.assertEquals(noDefaultEumLengthOneModel.defaultValue, "15.0");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**value** | **str** | | if omitted the server will use the default value of "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
|
||||
**value** | **str** | | defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -99,13 +99,16 @@ class AnimalFarm(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""AnimalFarm - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value ([Animal]): # noqa: E501
|
||||
args[0] ([Animal]): # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value ([Animal]): # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,18 @@ class AnimalFarm(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -99,13 +99,16 @@ class EnumClass(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""EnumClass - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (str): if omitted the server will use the default value of "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
|
||||
args[0] (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,14 @@ class EnumClass(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
value = "-efg"
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -98,13 +98,16 @@ class NumberWithValidations(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""NumberWithValidations - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (float): # noqa: E501
|
||||
args[0] (float): # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (float): # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -137,6 +140,18 @@ class NumberWithValidations(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -99,13 +99,16 @@ class StringEnum(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""StringEnum - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (str):, must be one of ["placed", "approved", "delivered", ] # noqa: E501
|
||||
args[0] (str):, must be one of ["placed", "approved", "delivered", ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (str):, must be one of ["placed", "approved", "delivered", ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,18 @@ class StringEnum(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**value** | **str** | | if omitted the server will use the default value of "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
|
||||
**value** | **str** | | defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**value** | **int** | | if omitted the server will use the default value of 0, must be one of [0, 1, 2, ]
|
||||
**value** | **int** | | defaults to 0, must be one of [0, 1, 2, ]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**value** | **str** | | if omitted the server will use the default value of "placed", must be one of ["placed", "approved", "delivered", ]
|
||||
**value** | **str** | | defaults to "placed", must be one of ["placed", "approved", "delivered", ]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -99,13 +99,16 @@ class AnimalFarm(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""AnimalFarm - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value ([Animal]): # noqa: E501
|
||||
args[0] ([Animal]): # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value ([Animal]): # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,18 @@ class AnimalFarm(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -99,13 +99,16 @@ class ArrayOfEnums(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""ArrayOfEnums - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value ([StringEnum]): # noqa: E501
|
||||
args[0] ([StringEnum]): # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value ([StringEnum]): # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,18 @@ class ArrayOfEnums(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -99,13 +99,16 @@ class EnumClass(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""EnumClass - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (str): if omitted the server will use the default value of "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
|
||||
args[0] (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,14 @@ class EnumClass(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
value = "-efg"
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -99,13 +99,16 @@ class IntegerEnum(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""IntegerEnum - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (int):, must be one of [0, 1, 2, ] # noqa: E501
|
||||
args[0] (int):, must be one of [0, 1, 2, ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (int):, must be one of [0, 1, 2, ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,18 @@ class IntegerEnum(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -100,8 +100,13 @@ class IntegerEnumOneValue(ModelSimple):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""IntegerEnumOneValue - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
args[0] (int): if omitted defaults to 0, must be one of [0, ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (int): defaults to 0, must be one of [0, ] # noqa: E501
|
||||
value (int): if omitted defaults to 0, must be one of [0, ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -141,6 +146,7 @@ class IntegerEnumOneValue(ModelSimple):
|
||||
value = args.pop(0)
|
||||
else:
|
||||
value = 0
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -99,13 +99,16 @@ class IntegerEnumWithDefaultValue(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""IntegerEnumWithDefaultValue - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (int): if omitted the server will use the default value of 0, must be one of [0, 1, 2, ] # noqa: E501
|
||||
args[0] (int): if omitted defaults to 0, must be one of [0, 1, 2, ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (int): if omitted defaults to 0, must be one of [0, 1, 2, ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,14 @@ class IntegerEnumWithDefaultValue(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
value = 0
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -98,13 +98,16 @@ class NumberWithValidations(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""NumberWithValidations - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (float): # noqa: E501
|
||||
args[0] (float): # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (float): # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -137,6 +140,18 @@ class NumberWithValidations(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -105,15 +105,20 @@ lines''',
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""StringEnum - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (str):, must be one of ["placed", "approved", "delivered", "single quoted", '''multiple
|
||||
args[0] (str):, must be one of ["placed", "approved", "delivered", "single quoted", '''multiple
|
||||
lines''', '''double quote
|
||||
with newline''', ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (str):, must be one of ["placed", "approved", "delivered", "single quoted", '''multiple
|
||||
lines''', '''double quote
|
||||
with newline''', ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -146,6 +151,18 @@ lines''', '''double quote
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
raise ApiTypeError(
|
||||
"value is required, but not passed in args or kwargs and doesn't have default",
|
||||
path_to_item=_path_to_item,
|
||||
valid_classes=(self.__class__,),
|
||||
)
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -99,13 +99,16 @@ class StringEnumWithDefaultValue(ModelSimple):
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, value, *args, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""StringEnumWithDefaultValue - a model defined in OpenAPI
|
||||
|
||||
Note that value can be passed either in args or in kwargs, but not in both.
|
||||
|
||||
Args:
|
||||
value (str): if omitted the server will use the default value of "placed", must be one of ["placed", "approved", "delivered", ] # noqa: E501
|
||||
args[0] (str): if omitted defaults to "placed", must be one of ["placed", "approved", "delivered", ] # noqa: E501
|
||||
|
||||
Keyword Args:
|
||||
value (str): if omitted defaults to "placed", must be one of ["placed", "approved", "delivered", ] # noqa: E501
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
@@ -138,6 +141,14 @@ class StringEnumWithDefaultValue(ModelSimple):
|
||||
_visited_composed_classes = (Animal,)
|
||||
"""
|
||||
|
||||
if 'value' in kwargs:
|
||||
value = kwargs.pop('value')
|
||||
elif args:
|
||||
args = list(args)
|
||||
value = args.pop(0)
|
||||
else:
|
||||
value = "placed"
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF
|
||||
NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F
|
||||
UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB
|
||||
AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA
|
||||
QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK
|
||||
kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg
|
||||
f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u
|
||||
412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc
|
||||
mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7
|
||||
kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA
|
||||
gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW
|
||||
G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI
|
||||
7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
Reference in New Issue
Block a user