forked from loafle/openapi-generator-original
update samples
This commit is contained in:
parent
37eaf70755
commit
73564bc046
@ -1 +1 @@
|
||||
5.1.1-SNAPSHOT
|
||||
5.2.0-SNAPSHOT
|
@ -1508,13 +1508,19 @@ def model_to_dict(model_instance, serialize=True):
|
||||
# exist in attribute_map
|
||||
attr = model_instance.attribute_map.get(attr, attr)
|
||||
if isinstance(value, list):
|
||||
if not value or isinstance(value[0], PRIMITIVE_TYPES):
|
||||
# empty list or primitive types
|
||||
result[attr] = value
|
||||
elif isinstance(value[0], ModelSimple):
|
||||
result[attr] = [x.value for x in value]
|
||||
else:
|
||||
result[attr] = [model_to_dict(x, serialize=serialize) for x in value]
|
||||
if not value:
|
||||
# empty list or None
|
||||
result[attr] = value
|
||||
else:
|
||||
res = []
|
||||
for v in value:
|
||||
if isinstance(v, PRIMITIVE_TYPES) or v is None:
|
||||
res.append(v)
|
||||
elif isinstance(v, ModelSimple):
|
||||
res.append(v.value)
|
||||
else:
|
||||
res.append(model_to_dict(v, serialize=serialize))
|
||||
result[attr] = res
|
||||
elif isinstance(value, dict):
|
||||
result[attr] = dict(map(
|
||||
lambda item: (item[0],
|
||||
@ -1574,11 +1580,16 @@ def get_valid_classes_phrase(input_classes):
|
||||
def convert_js_args_to_python_args(fn):
|
||||
from functools import wraps
|
||||
@wraps(fn)
|
||||
def wrapped_init(self, *args, **kwargs):
|
||||
def wrapped_init(_self, *args, **kwargs):
|
||||
"""
|
||||
An attribute named `self` received from the api will conflicts with the reserved `self`
|
||||
parameter of a class method. During generation, `self` attributes are mapped
|
||||
to `_self` in models. Here, we name `_self` instead of `self` to avoid conflicts.
|
||||
"""
|
||||
spec_property_naming = kwargs.get('_spec_property_naming', False)
|
||||
if spec_property_naming:
|
||||
kwargs = change_keys_js_to_python(kwargs, self.__class__)
|
||||
return fn(self, *args, **kwargs)
|
||||
kwargs = change_keys_js_to_python(kwargs, _self.__class__)
|
||||
return fn(_self, *args, **kwargs)
|
||||
return wrapped_init
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**labels** | **[str, none_type]** | | [optional]
|
||||
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -6,6 +6,7 @@ this payload is used for verification that some model_to_dict issues are fixed
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**array_data** | [**[FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type**](FakeGetInlineAdditionalPropertiesPayloadArrayData.md) | | [optional]
|
||||
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -6,6 +6,7 @@ this payload is used for verification that some model_to_dict issues are fixed
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**array_data** | [**[FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type**](FakeGetInlineAdditionalPropertiesPayloadArrayData.md) | | [optional]
|
||||
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **str** | | [optional]
|
||||
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**_self** | **str** | | [optional]
|
||||
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -57,7 +57,13 @@ class FakeGetInlineAdditionalPropertiesPayloadArrayData(ModelNormal):
|
||||
validations = {
|
||||
}
|
||||
|
||||
additional_properties_type = None
|
||||
@cached_property
|
||||
def additional_properties_type():
|
||||
"""
|
||||
This must be a method because a model may have properties that are
|
||||
of type self, this must run after the class is loaded
|
||||
"""
|
||||
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
|
||||
|
||||
_nullable = False
|
||||
|
||||
|
@ -61,7 +61,14 @@ class InlineAdditionalPropertiesRefPayload(ModelNormal):
|
||||
validations = {
|
||||
}
|
||||
|
||||
additional_properties_type = None
|
||||
@cached_property
|
||||
def additional_properties_type():
|
||||
"""
|
||||
This must be a method because a model may have properties that are
|
||||
of type self, this must run after the class is loaded
|
||||
"""
|
||||
lazy_import()
|
||||
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
|
||||
|
||||
_nullable = False
|
||||
|
||||
|
@ -61,7 +61,14 @@ class InlineObject6(ModelNormal):
|
||||
validations = {
|
||||
}
|
||||
|
||||
additional_properties_type = None
|
||||
@cached_property
|
||||
def additional_properties_type():
|
||||
"""
|
||||
This must be a method because a model may have properties that are
|
||||
of type self, this must run after the class is loaded
|
||||
"""
|
||||
lazy_import()
|
||||
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
|
||||
|
||||
_nullable = False
|
||||
|
||||
|
@ -57,7 +57,13 @@ class Readonly(ModelNormal):
|
||||
validations = {
|
||||
}
|
||||
|
||||
additional_properties_type = None
|
||||
@cached_property
|
||||
def additional_properties_type():
|
||||
"""
|
||||
This must be a method because a model may have properties that are
|
||||
of type self, this must run after the class is loaded
|
||||
"""
|
||||
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
|
||||
|
||||
_nullable = False
|
||||
|
||||
|
@ -57,7 +57,13 @@ class SomeObjectWithSelfAttr(ModelNormal):
|
||||
validations = {
|
||||
}
|
||||
|
||||
additional_properties_type = None
|
||||
@cached_property
|
||||
def additional_properties_type():
|
||||
"""
|
||||
This must be a method because a model may have properties that are
|
||||
of type self, this must run after the class is loaded
|
||||
"""
|
||||
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
|
||||
|
||||
_nullable = False
|
||||
|
||||
|
@ -1 +1 @@
|
||||
5.1.1-SNAPSHOT
|
||||
5.2.0-SNAPSHOT
|
Loading…
x
Reference in New Issue
Block a user