mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 22:50:53 +00:00
[python] Fix unnamed dicts with additional properties (#16779)
* test: Add two extra models for testing * Fix unnamed dicts with additional properties Closes #16630
This commit is contained in:
parent
7af459396c
commit
f180aa0eec
@ -182,15 +182,17 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
|||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{#isMap}}
|
{{#isMap}}
|
||||||
{{#items.isArray}}
|
{{#items.isArray}}
|
||||||
|
{{^items.items.isPrimitiveType}}
|
||||||
# override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict of array)
|
# override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict of array)
|
||||||
_field_dict_of_array = {}
|
_field_dict_of_array = {}
|
||||||
if self.{{{name}}}:
|
if self.{{{name}}}:
|
||||||
for _key in self.{{{name}}}:
|
for _key in self.{{{name}}}:
|
||||||
if self.{{{name}}}[_key]:
|
if self.{{{name}}}[_key] is not None:
|
||||||
_field_dict_of_array[_key] = [
|
_field_dict_of_array[_key] = [
|
||||||
_item.to_dict() for _item in self.{{{name}}}[_key]
|
_item.to_dict() for _item in self.{{{name}}}[_key]
|
||||||
]
|
]
|
||||||
_dict['{{{baseName}}}'] = _field_dict_of_array
|
_dict['{{{baseName}}}'] = _field_dict_of_array
|
||||||
|
{{/items.items.isPrimitiveType}}
|
||||||
{{/items.isArray}}
|
{{/items.isArray}}
|
||||||
{{^items.isArray}}
|
{{^items.isArray}}
|
||||||
{{^items.isPrimitiveType}}
|
{{^items.isPrimitiveType}}
|
||||||
|
@ -2351,3 +2351,21 @@ components:
|
|||||||
title: ListOfObjects
|
title: ListOfObjects
|
||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/Tag"
|
$ref: "#/components/schemas/Tag"
|
||||||
|
UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
dictProperty:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
dictProperty:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/CreatureInfo"
|
||||||
|
@ -86,6 +86,8 @@ docs/StoreApi.md
|
|||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
docs/Tiger.md
|
docs/Tiger.md
|
||||||
|
docs/UnnamedDictWithAdditionalModelListProperties.md
|
||||||
|
docs/UnnamedDictWithAdditionalStringListProperties.md
|
||||||
docs/User.md
|
docs/User.md
|
||||||
docs/UserApi.md
|
docs/UserApi.md
|
||||||
docs/WithNestedOneOf.md
|
docs/WithNestedOneOf.md
|
||||||
@ -181,6 +183,8 @@ petstore_api/models/special_name.py
|
|||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
petstore_api/models/tiger.py
|
petstore_api/models/tiger.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_model_list_properties.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_string_list_properties.py
|
||||||
petstore_api/models/user.py
|
petstore_api/models/user.py
|
||||||
petstore_api/models/with_nested_one_of.py
|
petstore_api/models/with_nested_one_of.py
|
||||||
petstore_api/py.typed
|
petstore_api/py.typed
|
||||||
|
@ -212,6 +212,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
- [Tiger](docs/Tiger.md)
|
- [Tiger](docs/Tiger.md)
|
||||||
|
- [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md)
|
||||||
|
- [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[CreatureInfo]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_model_list_properties_instance = UnnamedDictWithAdditionalModelListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalModelListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_dict = unnamed_dict_with_additional_model_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_form_dict = unnamed_dict_with_additional_model_list_properties.from_dict(unnamed_dict_with_additional_model_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[str]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_string_list_properties_instance = UnnamedDictWithAdditionalStringListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalStringListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_dict = unnamed_dict_with_additional_string_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_form_dict = unnamed_dict_with_additional_string_list_properties.from_dict(unnamed_dict_with_additional_string_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -115,5 +115,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -91,5 +91,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -75,7 +75,7 @@ class MapOfArrayOfModel(BaseModel):
|
|||||||
_field_dict_of_array = {}
|
_field_dict_of_array = {}
|
||||||
if self.shop_id_to_org_online_lip_map:
|
if self.shop_id_to_org_online_lip_map:
|
||||||
for _key in self.shop_id_to_org_online_lip_map:
|
for _key in self.shop_id_to_org_online_lip_map:
|
||||||
if self.shop_id_to_org_online_lip_map[_key]:
|
if self.shop_id_to_org_online_lip_map[_key] is not None:
|
||||||
_field_dict_of_array[_key] = [
|
_field_dict_of_array[_key] = [
|
||||||
_item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key]
|
_item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key]
|
||||||
]
|
]
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Dict, List, Optional
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from pydantic import Field
|
||||||
|
from petstore_api.models.creature_info import CreatureInfo
|
||||||
|
from typing import Dict, Any
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalModelListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalModelListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, List[CreatureInfo]]] = Field(default=None, alias="dictProperty")
|
||||||
|
__properties: ClassVar[List[str]] = ["dictProperty"]
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.model_dump(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
|
_field_dict_of_array = {}
|
||||||
|
if self.dict_property:
|
||||||
|
for _key in self.dict_property:
|
||||||
|
if self.dict_property[_key] is not None:
|
||||||
|
_field_dict_of_array[_key] = [
|
||||||
|
_item.to_dict() for _item in self.dict_property[_key]
|
||||||
|
]
|
||||||
|
_dict['dictProperty'] = _field_dict_of_array
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"dictProperty": dict(
|
||||||
|
(_k,
|
||||||
|
[CreatureInfo.from_dict(_item) for _item in _v]
|
||||||
|
if _v is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
for _k, _v in obj.get("dictProperty").items()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Dict, List, Optional
|
||||||
|
from pydantic import BaseModel, StrictStr
|
||||||
|
from pydantic import Field
|
||||||
|
from typing import Dict, Any
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalStringListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, List[StrictStr]]] = Field(default=None, alias="dictProperty")
|
||||||
|
__properties: ClassVar[List[str]] = ["dictProperty"]
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.model_dump(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"dictProperty": obj.get("dictProperty")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalModelListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalModelListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalModelListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalModelListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
petstore_api.models.creature_info.CreatureInfo(
|
||||||
|
name = '', )
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalModelListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,56 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalStringListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalStringListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalStringListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalStringListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
''
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalStringListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -86,6 +86,8 @@ docs/StoreApi.md
|
|||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
docs/Tiger.md
|
docs/Tiger.md
|
||||||
|
docs/UnnamedDictWithAdditionalModelListProperties.md
|
||||||
|
docs/UnnamedDictWithAdditionalStringListProperties.md
|
||||||
docs/User.md
|
docs/User.md
|
||||||
docs/UserApi.md
|
docs/UserApi.md
|
||||||
docs/WithNestedOneOf.md
|
docs/WithNestedOneOf.md
|
||||||
@ -181,6 +183,8 @@ petstore_api/models/special_name.py
|
|||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
petstore_api/models/tiger.py
|
petstore_api/models/tiger.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_model_list_properties.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_string_list_properties.py
|
||||||
petstore_api/models/user.py
|
petstore_api/models/user.py
|
||||||
petstore_api/models/with_nested_one_of.py
|
petstore_api/models/with_nested_one_of.py
|
||||||
petstore_api/py.typed
|
petstore_api/py.typed
|
||||||
|
@ -212,6 +212,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
- [Tiger](docs/Tiger.md)
|
- [Tiger](docs/Tiger.md)
|
||||||
|
- [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md)
|
||||||
|
- [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[CreatureInfo]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_model_list_properties_instance = UnnamedDictWithAdditionalModelListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalModelListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_dict = unnamed_dict_with_additional_model_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_form_dict = unnamed_dict_with_additional_model_list_properties.from_dict(unnamed_dict_with_additional_model_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[str]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_string_list_properties_instance = UnnamedDictWithAdditionalStringListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalStringListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_dict = unnamed_dict_with_additional_string_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_form_dict = unnamed_dict_with_additional_string_list_properties.from_dict(unnamed_dict_with_additional_string_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -115,5 +115,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -91,5 +91,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Dict, List, Optional
|
||||||
|
from pydantic import BaseModel, Field, conlist
|
||||||
|
from petstore_api.models.creature_info import CreatureInfo
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalModelListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalModelListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, conlist(CreatureInfo)]] = Field(None, alias="dictProperty")
|
||||||
|
__properties = ["dictProperty"]
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
|
_field_dict_of_array = {}
|
||||||
|
if self.dict_property:
|
||||||
|
for _key in self.dict_property:
|
||||||
|
if self.dict_property[_key]:
|
||||||
|
_field_dict_of_array[_key] = [
|
||||||
|
_item.to_dict() for _item in self.dict_property[_key]
|
||||||
|
]
|
||||||
|
_dict['dictProperty'] = _field_dict_of_array
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = UnnamedDictWithAdditionalModelListProperties.parse_obj({
|
||||||
|
"dict_property": dict(
|
||||||
|
(_k,
|
||||||
|
[CreatureInfo.from_dict(_item) for _item in _v]
|
||||||
|
if _v is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
for _k, _v in obj.get("dictProperty").items()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Dict, List, Optional
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, conlist
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalStringListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, conlist(StrictStr)]] = Field(None, alias="dictProperty")
|
||||||
|
__properties = ["dictProperty"]
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
|
_field_dict_of_array = {}
|
||||||
|
if self.dict_property:
|
||||||
|
for _key in self.dict_property:
|
||||||
|
if self.dict_property[_key]:
|
||||||
|
_field_dict_of_array[_key] = [
|
||||||
|
_item.to_dict() for _item in self.dict_property[_key]
|
||||||
|
]
|
||||||
|
_dict['dictProperty'] = _field_dict_of_array
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = UnnamedDictWithAdditionalStringListProperties.parse_obj({
|
||||||
|
"dict_property": obj.get("dictProperty")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalModelListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalModelListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalModelListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalModelListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
petstore_api.models.creature_info.CreatureInfo(
|
||||||
|
name = '', )
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalModelListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,56 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalStringListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalStringListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalStringListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalStringListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
''
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalStringListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -86,6 +86,8 @@ docs/StoreApi.md
|
|||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
docs/Tiger.md
|
docs/Tiger.md
|
||||||
|
docs/UnnamedDictWithAdditionalModelListProperties.md
|
||||||
|
docs/UnnamedDictWithAdditionalStringListProperties.md
|
||||||
docs/User.md
|
docs/User.md
|
||||||
docs/UserApi.md
|
docs/UserApi.md
|
||||||
docs/WithNestedOneOf.md
|
docs/WithNestedOneOf.md
|
||||||
@ -181,6 +183,8 @@ petstore_api/models/special_name.py
|
|||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
petstore_api/models/tiger.py
|
petstore_api/models/tiger.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_model_list_properties.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_string_list_properties.py
|
||||||
petstore_api/models/user.py
|
petstore_api/models/user.py
|
||||||
petstore_api/models/with_nested_one_of.py
|
petstore_api/models/with_nested_one_of.py
|
||||||
petstore_api/py.typed
|
petstore_api/py.typed
|
||||||
|
@ -212,6 +212,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
- [Tiger](docs/Tiger.md)
|
- [Tiger](docs/Tiger.md)
|
||||||
|
- [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md)
|
||||||
|
- [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[CreatureInfo]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_model_list_properties_instance = UnnamedDictWithAdditionalModelListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalModelListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_dict = unnamed_dict_with_additional_model_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_form_dict = unnamed_dict_with_additional_model_list_properties.from_dict(unnamed_dict_with_additional_model_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[str]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_string_list_properties_instance = UnnamedDictWithAdditionalStringListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalStringListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_dict = unnamed_dict_with_additional_string_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_form_dict = unnamed_dict_with_additional_string_list_properties.from_dict(unnamed_dict_with_additional_string_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -115,5 +115,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -91,5 +91,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -0,0 +1,100 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
from pydantic import BaseModel, Field, conlist
|
||||||
|
from petstore_api.models.creature_info import CreatureInfo
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalModelListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalModelListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, conlist(CreatureInfo)]] = Field(None, alias="dictProperty")
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties = ["dictProperty"]
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
|
_field_dict_of_array = {}
|
||||||
|
if self.dict_property:
|
||||||
|
for _key in self.dict_property:
|
||||||
|
if self.dict_property[_key]:
|
||||||
|
_field_dict_of_array[_key] = [
|
||||||
|
_item.to_dict() for _item in self.dict_property[_key]
|
||||||
|
]
|
||||||
|
_dict['dictProperty'] = _field_dict_of_array
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = UnnamedDictWithAdditionalModelListProperties.parse_obj({
|
||||||
|
"dict_property": dict(
|
||||||
|
(_k,
|
||||||
|
[CreatureInfo.from_dict(_item) for _item in _v]
|
||||||
|
if _v is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
for _k, _v in obj.get("dictProperty").items()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,92 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, conlist
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalStringListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, conlist(StrictStr)]] = Field(None, alias="dictProperty")
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties = ["dictProperty"]
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
|
_field_dict_of_array = {}
|
||||||
|
if self.dict_property:
|
||||||
|
for _key in self.dict_property:
|
||||||
|
if self.dict_property[_key]:
|
||||||
|
_field_dict_of_array[_key] = [
|
||||||
|
_item.to_dict() for _item in self.dict_property[_key]
|
||||||
|
]
|
||||||
|
_dict['dictProperty'] = _field_dict_of_array
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = UnnamedDictWithAdditionalStringListProperties.parse_obj({
|
||||||
|
"dict_property": obj.get("dictProperty")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalModelListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalModelListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalModelListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalModelListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
petstore_api.models.creature_info.CreatureInfo(
|
||||||
|
name = '', )
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalModelListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,56 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalStringListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalStringListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalStringListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalStringListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
''
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalStringListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -86,6 +86,8 @@ docs/StoreApi.md
|
|||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
docs/Tiger.md
|
docs/Tiger.md
|
||||||
|
docs/UnnamedDictWithAdditionalModelListProperties.md
|
||||||
|
docs/UnnamedDictWithAdditionalStringListProperties.md
|
||||||
docs/User.md
|
docs/User.md
|
||||||
docs/UserApi.md
|
docs/UserApi.md
|
||||||
docs/WithNestedOneOf.md
|
docs/WithNestedOneOf.md
|
||||||
@ -181,6 +183,8 @@ petstore_api/models/special_name.py
|
|||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
petstore_api/models/tiger.py
|
petstore_api/models/tiger.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_model_list_properties.py
|
||||||
|
petstore_api/models/unnamed_dict_with_additional_string_list_properties.py
|
||||||
petstore_api/models/user.py
|
petstore_api/models/user.py
|
||||||
petstore_api/models/with_nested_one_of.py
|
petstore_api/models/with_nested_one_of.py
|
||||||
petstore_api/py.typed
|
petstore_api/py.typed
|
||||||
|
@ -212,6 +212,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
- [Tiger](docs/Tiger.md)
|
- [Tiger](docs/Tiger.md)
|
||||||
|
- [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md)
|
||||||
|
- [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
- [WithNestedOneOf](docs/WithNestedOneOf.md)
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[CreatureInfo]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_model_list_properties_instance = UnnamedDictWithAdditionalModelListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalModelListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_dict = unnamed_dict_with_additional_model_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalModelListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_model_list_properties_form_dict = unnamed_dict_with_additional_model_list_properties.from_dict(unnamed_dict_with_additional_model_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
# UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**dict_property** | **Dict[str, List[str]]** | | [optional]
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string
|
||||||
|
unnamed_dict_with_additional_string_list_properties_instance = UnnamedDictWithAdditionalStringListProperties.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print UnnamedDictWithAdditionalStringListProperties.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_dict = unnamed_dict_with_additional_string_list_properties_instance.to_dict()
|
||||||
|
# create an instance of UnnamedDictWithAdditionalStringListProperties from a dict
|
||||||
|
unnamed_dict_with_additional_string_list_properties_form_dict = unnamed_dict_with_additional_string_list_properties.from_dict(unnamed_dict_with_additional_string_list_properties_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -115,5 +115,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -91,5 +91,7 @@ from petstore_api.models.special_name import SpecialName
|
|||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
from petstore_api.models.tiger import Tiger
|
from petstore_api.models.tiger import Tiger
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
|
||||||
from petstore_api.models.user import User
|
from petstore_api.models.user import User
|
||||||
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
from petstore_api.models.with_nested_one_of import WithNestedOneOf
|
||||||
|
@ -78,7 +78,7 @@ class MapOfArrayOfModel(BaseModel):
|
|||||||
_field_dict_of_array = {}
|
_field_dict_of_array = {}
|
||||||
if self.shop_id_to_org_online_lip_map:
|
if self.shop_id_to_org_online_lip_map:
|
||||||
for _key in self.shop_id_to_org_online_lip_map:
|
for _key in self.shop_id_to_org_online_lip_map:
|
||||||
if self.shop_id_to_org_online_lip_map[_key]:
|
if self.shop_id_to_org_online_lip_map[_key] is not None:
|
||||||
_field_dict_of_array[_key] = [
|
_field_dict_of_array[_key] = [
|
||||||
_item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key]
|
_item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key]
|
||||||
]
|
]
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, ClassVar, Dict, List, Optional
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from pydantic import Field
|
||||||
|
from petstore_api.models.creature_info import CreatureInfo
|
||||||
|
from typing import Dict, Any
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalModelListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalModelListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, List[CreatureInfo]]] = Field(default=None, alias="dictProperty")
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties: ClassVar[List[str]] = ["dictProperty"]
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.model_dump(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
|
_field_dict_of_array = {}
|
||||||
|
if self.dict_property:
|
||||||
|
for _key in self.dict_property:
|
||||||
|
if self.dict_property[_key] is not None:
|
||||||
|
_field_dict_of_array[_key] = [
|
||||||
|
_item.to_dict() for _item in self.dict_property[_key]
|
||||||
|
]
|
||||||
|
_dict['dictProperty'] = _field_dict_of_array
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"dictProperty": dict(
|
||||||
|
(_k,
|
||||||
|
[CreatureInfo.from_dict(_item) for _item in _v]
|
||||||
|
if _v is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
for _k, _v in obj.get("dictProperty").items()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, ClassVar, Dict, List, Optional
|
||||||
|
from pydantic import BaseModel, StrictStr
|
||||||
|
from pydantic import Field
|
||||||
|
from typing import Dict, Any
|
||||||
|
try:
|
||||||
|
from typing import Self
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
||||||
|
"""
|
||||||
|
UnnamedDictWithAdditionalStringListProperties
|
||||||
|
"""
|
||||||
|
dict_property: Optional[Dict[str, List[StrictStr]]] = Field(default=None, alias="dictProperty")
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties: ClassVar[List[str]] = ["dictProperty"]
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.model_dump(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Self:
|
||||||
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"dictProperty": obj.get("dictProperty")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalModelListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalModelListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalModelListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalModelListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalModelListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
petstore_api.models.creature_info.CreatureInfo(
|
||||||
|
name = '', )
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalModelListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalModelListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalModelListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,56 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties # noqa: E501
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalStringListProperties(unittest.TestCase):
|
||||||
|
"""UnnamedDictWithAdditionalStringListProperties unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> UnnamedDictWithAdditionalStringListProperties:
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `UnnamedDictWithAdditionalStringListProperties`
|
||||||
|
"""
|
||||||
|
model = UnnamedDictWithAdditionalStringListProperties() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
dict_property = {
|
||||||
|
'key' : [
|
||||||
|
''
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return UnnamedDictWithAdditionalStringListProperties(
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testUnnamedDictWithAdditionalStringListProperties(self):
|
||||||
|
"""Test UnnamedDictWithAdditionalStringListProperties"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -587,3 +587,30 @@ class ModelTests(unittest.TestCase):
|
|||||||
a3.additional_properties = { "xyz": 45.6 }
|
a3.additional_properties = { "xyz": 45.6 }
|
||||||
self.assertEqual(a3.to_dict(), {"xyz": 45.6})
|
self.assertEqual(a3.to_dict(), {"xyz": 45.6})
|
||||||
self.assertEqual(a3.to_json(), '{"xyz": 45.6}')
|
self.assertEqual(a3.to_json(), '{"xyz": 45.6}')
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalStringListProperties:
|
||||||
|
def test_empty_dict(self):
|
||||||
|
a = petstore_api.UnnamedDictWithAdditionalStringListProperties(dict_property={})
|
||||||
|
assert a.to_dict() == {"dictProperty": {}}
|
||||||
|
|
||||||
|
def test_empty_list(self):
|
||||||
|
a = petstore_api.UnnamedDictWithAdditionalStringListProperties(dict_property={"b": []})
|
||||||
|
assert a.to_dict() == {"dictProperty": {"b": []}}
|
||||||
|
|
||||||
|
def test_single_string_item(self):
|
||||||
|
a = petstore_api.UnnamedDictWithAdditionalStringListProperties(dict_property={"b": ["c"]})
|
||||||
|
assert a.to_dict() == {"dictProperty": {"b": ["c"]}}
|
||||||
|
|
||||||
|
class TestUnnamedDictWithAdditionalModelListProperties:
|
||||||
|
def test_empty_dict(self):
|
||||||
|
a = petstore_api.UnnamedDictWithAdditionalModelListProperties(dict_property={})
|
||||||
|
assert a.to_dict() == {"dictProperty": {}}
|
||||||
|
|
||||||
|
def test_empty_list(self):
|
||||||
|
a = petstore_api.UnnamedDictWithAdditionalModelListProperties(dict_property={"b": []})
|
||||||
|
assert a.to_dict() == {"dictProperty": {"b": []}}
|
||||||
|
|
||||||
|
def test_single_string_item(self):
|
||||||
|
value = {"b": [petstore_api.CreatureInfo(name="creature_name")]}
|
||||||
|
a = petstore_api.UnnamedDictWithAdditionalModelListProperties(dict_property=value)
|
||||||
|
assert a.to_dict() == {"dictProperty": {"b": [{"name": "creature_name"}]}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user