Skip to content

Commit d91c8eb

Browse files
committed
add remaining updated samples
1 parent bed1c90 commit d91c8eb

360 files changed

Lines changed: 5313 additions & 309 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/client/echo_api/python-pydantic-v1/openapi_client/models/bird.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121

22-
from typing import Optional
22+
from typing import Any, Dict, Optional
2323
from pydantic import BaseModel, StrictStr
2424

2525
class Bird(BaseModel):
@@ -28,6 +28,7 @@ class Bird(BaseModel):
2828
"""
2929
size: Optional[StrictStr] = None
3030
color: Optional[StrictStr] = None
31+
additional_properties: Dict[str, Any] = {}
3132
__properties = ["size", "color"]
3233

3334
class Config:
@@ -52,8 +53,14 @@ def to_dict(self):
5253
"""Returns the dictionary representation of the model using alias"""
5354
_dict = self.dict(by_alias=True,
5455
exclude={
56+
"additional_properties"
5557
},
5658
exclude_none=True)
59+
# puts key-value pairs in additional_properties in the top level
60+
if self.additional_properties is not None:
61+
for _key, _value in self.additional_properties.items():
62+
_dict[_key] = _value
63+
5764
return _dict
5865

5966
@classmethod
@@ -69,6 +76,11 @@ def from_dict(cls, obj: dict) -> Bird:
6976
"size": obj.get("size"),
7077
"color": obj.get("color")
7178
})
79+
# store additional fields in additional_properties
80+
for _key in obj.keys():
81+
if _key not in cls.__properties:
82+
_obj.additional_properties[_key] = obj.get(_key)
83+
7284
return _obj
7385

7486

samples/client/echo_api/python-pydantic-v1/openapi_client/models/category.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121

22-
from typing import Optional
22+
from typing import Any, Dict, Optional
2323
from pydantic import BaseModel, StrictInt, StrictStr
2424

2525
class Category(BaseModel):
@@ -28,6 +28,7 @@ class Category(BaseModel):
2828
"""
2929
id: Optional[StrictInt] = None
3030
name: Optional[StrictStr] = None
31+
additional_properties: Dict[str, Any] = {}
3132
__properties = ["id", "name"]
3233

3334
class Config:
@@ -52,8 +53,14 @@ def to_dict(self):
5253
"""Returns the dictionary representation of the model using alias"""
5354
_dict = self.dict(by_alias=True,
5455
exclude={
56+
"additional_properties"
5557
},
5658
exclude_none=True)
59+
# puts key-value pairs in additional_properties in the top level
60+
if self.additional_properties is not None:
61+
for _key, _value in self.additional_properties.items():
62+
_dict[_key] = _value
63+
5764
return _dict
5865

5966
@classmethod
@@ -69,6 +76,11 @@ def from_dict(cls, obj: dict) -> Category:
6976
"id": obj.get("id"),
7077
"name": obj.get("name")
7178
})
79+
# store additional fields in additional_properties
80+
for _key in obj.keys():
81+
if _key not in cls.__properties:
82+
_obj.additional_properties[_key] = obj.get(_key)
83+
7284
return _obj
7385

7486

samples/client/echo_api/python-pydantic-v1/openapi_client/models/data_query.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121
from datetime import datetime
22-
from typing import Optional
22+
from typing import Any, Dict, Optional
2323
from pydantic import Field, StrictStr
2424
from openapi_client.models.query import Query
2525

@@ -30,6 +30,7 @@ class DataQuery(Query):
3030
suffix: Optional[StrictStr] = Field(default=None, description="test suffix")
3131
text: Optional[StrictStr] = Field(default=None, description="Some text containing white spaces")
3232
var_date: Optional[datetime] = Field(default=None, alias="date", description="A date")
33+
additional_properties: Dict[str, Any] = {}
3334
__properties = ["id", "outcomes", "suffix", "text", "date"]
3435

3536
class Config:
@@ -54,8 +55,14 @@ def to_dict(self):
5455
"""Returns the dictionary representation of the model using alias"""
5556
_dict = self.dict(by_alias=True,
5657
exclude={
58+
"additional_properties"
5759
},
5860
exclude_none=True)
61+
# puts key-value pairs in additional_properties in the top level
62+
if self.additional_properties is not None:
63+
for _key, _value in self.additional_properties.items():
64+
_dict[_key] = _value
65+
5966
return _dict
6067

6168
@classmethod
@@ -74,6 +81,11 @@ def from_dict(cls, obj: dict) -> DataQuery:
7481
"text": obj.get("text"),
7582
"var_date": obj.get("date")
7683
})
84+
# store additional fields in additional_properties
85+
for _key in obj.keys():
86+
if _key not in cls.__properties:
87+
_obj.additional_properties[_key] = obj.get(_key)
88+
7789
return _obj
7890

7991

samples/client/echo_api/python-pydantic-v1/openapi_client/models/default_value.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121

22-
from typing import List, Optional
22+
from typing import Any, Dict, List, Optional
2323
from pydantic import BaseModel, StrictInt, StrictStr, conlist, validator
2424
from openapi_client.models.string_enum_ref import StringEnumRef
2525

@@ -35,6 +35,7 @@ class DefaultValue(BaseModel):
3535
array_string_nullable: Optional[conlist(StrictStr)] = None
3636
array_string_extension_nullable: Optional[conlist(StrictStr)] = None
3737
string_nullable: Optional[StrictStr] = None
38+
additional_properties: Dict[str, Any] = {}
3839
__properties = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"]
3940

4041
@validator('array_string_enum_default')
@@ -70,8 +71,14 @@ def to_dict(self):
7071
"""Returns the dictionary representation of the model using alias"""
7172
_dict = self.dict(by_alias=True,
7273
exclude={
74+
"additional_properties"
7375
},
7476
exclude_none=True)
77+
# puts key-value pairs in additional_properties in the top level
78+
if self.additional_properties is not None:
79+
for _key, _value in self.additional_properties.items():
80+
_dict[_key] = _value
81+
7582
# set to None if array_string_nullable (nullable) is None
7683
# and __fields_set__ contains the field
7784
if self.array_string_nullable is None and "array_string_nullable" in self.__fields_set__:
@@ -108,6 +115,11 @@ def from_dict(cls, obj: dict) -> DefaultValue:
108115
"array_string_extension_nullable": obj.get("array_string_extension_nullable"),
109116
"string_nullable": obj.get("string_nullable")
110117
})
118+
# store additional fields in additional_properties
119+
for _key in obj.keys():
120+
if _key not in cls.__properties:
121+
_obj.additional_properties[_key] = obj.get(_key)
122+
111123
return _obj
112124

113125

samples/client/echo_api/python-pydantic-v1/openapi_client/models/number_properties_only.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121

22-
from typing import Optional, Union
22+
from typing import Any, Dict, Optional, Union
2323
from pydantic import BaseModel, StrictFloat, StrictInt, confloat, conint
2424

2525
class NumberPropertiesOnly(BaseModel):
@@ -29,6 +29,7 @@ class NumberPropertiesOnly(BaseModel):
2929
number: Optional[Union[StrictFloat, StrictInt]] = None
3030
float: Optional[Union[StrictFloat, StrictInt]] = None
3131
double: Optional[Union[confloat(le=50.2, ge=0.8, strict=True), conint(le=50, ge=1, strict=True)]] = None
32+
additional_properties: Dict[str, Any] = {}
3233
__properties = ["number", "float", "double"]
3334

3435
class Config:
@@ -53,8 +54,14 @@ def to_dict(self):
5354
"""Returns the dictionary representation of the model using alias"""
5455
_dict = self.dict(by_alias=True,
5556
exclude={
57+
"additional_properties"
5658
},
5759
exclude_none=True)
60+
# puts key-value pairs in additional_properties in the top level
61+
if self.additional_properties is not None:
62+
for _key, _value in self.additional_properties.items():
63+
_dict[_key] = _value
64+
5865
return _dict
5966

6067
@classmethod
@@ -71,6 +78,11 @@ def from_dict(cls, obj: dict) -> NumberPropertiesOnly:
7178
"float": obj.get("float"),
7279
"double": obj.get("double")
7380
})
81+
# store additional fields in additional_properties
82+
for _key in obj.keys():
83+
if _key not in cls.__properties:
84+
_obj.additional_properties[_key] = obj.get(_key)
85+
7486
return _obj
7587

7688

samples/client/echo_api/python-pydantic-v1/openapi_client/models/pet.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121

22-
from typing import List, Optional
22+
from typing import Any, Dict, List, Optional
2323
from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator
2424
from openapi_client.models.category import Category
2525
from openapi_client.models.tag import Tag
@@ -34,6 +34,7 @@ class Pet(BaseModel):
3434
photo_urls: conlist(StrictStr) = Field(default=..., alias="photoUrls")
3535
tags: Optional[conlist(Tag)] = None
3636
status: Optional[StrictStr] = Field(default=None, description="pet status in the store")
37+
additional_properties: Dict[str, Any] = {}
3738
__properties = ["id", "name", "category", "photoUrls", "tags", "status"]
3839

3940
@validator('status')
@@ -68,6 +69,7 @@ def to_dict(self):
6869
"""Returns the dictionary representation of the model using alias"""
6970
_dict = self.dict(by_alias=True,
7071
exclude={
72+
"additional_properties"
7173
},
7274
exclude_none=True)
7375
# override the default output from pydantic by calling `to_dict()` of category
@@ -80,6 +82,11 @@ def to_dict(self):
8082
if _item:
8183
_items.append(_item.to_dict())
8284
_dict['tags'] = _items
85+
# puts key-value pairs in additional_properties in the top level
86+
if self.additional_properties is not None:
87+
for _key, _value in self.additional_properties.items():
88+
_dict[_key] = _value
89+
8390
return _dict
8491

8592
@classmethod
@@ -99,6 +106,11 @@ def from_dict(cls, obj: dict) -> Pet:
99106
"tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None,
100107
"status": obj.get("status")
101108
})
109+
# store additional fields in additional_properties
110+
for _key in obj.keys():
111+
if _key not in cls.__properties:
112+
_obj.additional_properties[_key] = obj.get(_key)
113+
102114
return _obj
103115

104116

samples/client/echo_api/python-pydantic-v1/openapi_client/models/query.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121

22-
from typing import List, Optional
22+
from typing import Any, Dict, List, Optional
2323
from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator
2424

2525
class Query(BaseModel):
@@ -28,6 +28,7 @@ class Query(BaseModel):
2828
"""
2929
id: Optional[StrictInt] = Field(default=None, description="Query")
3030
outcomes: Optional[conlist(StrictStr)] = None
31+
additional_properties: Dict[str, Any] = {}
3132
__properties = ["id", "outcomes"]
3233

3334
@validator('outcomes')
@@ -63,8 +64,14 @@ def to_dict(self):
6364
"""Returns the dictionary representation of the model using alias"""
6465
_dict = self.dict(by_alias=True,
6566
exclude={
67+
"additional_properties"
6668
},
6769
exclude_none=True)
70+
# puts key-value pairs in additional_properties in the top level
71+
if self.additional_properties is not None:
72+
for _key, _value in self.additional_properties.items():
73+
_dict[_key] = _value
74+
6875
return _dict
6976

7077
@classmethod

samples/client/echo_api/python-pydantic-v1/openapi_client/models/tag.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020

2121

22-
from typing import Optional
22+
from typing import Any, Dict, Optional
2323
from pydantic import BaseModel, StrictInt, StrictStr
2424

2525
class Tag(BaseModel):
@@ -28,6 +28,7 @@ class Tag(BaseModel):
2828
"""
2929
id: Optional[StrictInt] = None
3030
name: Optional[StrictStr] = None
31+
additional_properties: Dict[str, Any] = {}
3132
__properties = ["id", "name"]
3233

3334
class Config:
@@ -52,8 +53,14 @@ def to_dict(self):
5253
"""Returns the dictionary representation of the model using alias"""
5354
_dict = self.dict(by_alias=True,
5455
exclude={
56+
"additional_properties"
5557
},
5658
exclude_none=True)
59+
# puts key-value pairs in additional_properties in the top level
60+
if self.additional_properties is not None:
61+
for _key, _value in self.additional_properties.items():
62+
_dict[_key] = _value
63+
5764
return _dict
5865

5966
@classmethod
@@ -69,6 +76,11 @@ def from_dict(cls, obj: dict) -> Tag:
6976
"id": obj.get("id"),
7077
"name": obj.get("name")
7178
})
79+
# store additional fields in additional_properties
80+
for _key in obj.keys():
81+
if _key not in cls.__properties:
82+
_obj.additional_properties[_key] = obj.get(_key)
83+
7284
return _obj
7385

7486

samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_form_object_multipart_request_marker.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
import json
2020

2121

22-
from typing import Optional
22+
from typing import Any, Dict, Optional
2323
from pydantic import BaseModel, StrictStr
2424

2525
class TestFormObjectMultipartRequestMarker(BaseModel):
2626
"""
2727
TestFormObjectMultipartRequestMarker
2828
"""
2929
name: Optional[StrictStr] = None
30+
additional_properties: Dict[str, Any] = {}
3031
__properties = ["name"]
3132

3233
class Config:
@@ -51,8 +52,14 @@ def to_dict(self):
5152
"""Returns the dictionary representation of the model using alias"""
5253
_dict = self.dict(by_alias=True,
5354
exclude={
55+
"additional_properties"
5456
},
5557
exclude_none=True)
58+
# puts key-value pairs in additional_properties in the top level
59+
if self.additional_properties is not None:
60+
for _key, _value in self.additional_properties.items():
61+
_dict[_key] = _value
62+
5663
return _dict
5764

5865
@classmethod
@@ -67,6 +74,11 @@ def from_dict(cls, obj: dict) -> TestFormObjectMultipartRequestMarker:
6774
_obj = TestFormObjectMultipartRequestMarker.parse_obj({
6875
"name": obj.get("name")
6976
})
77+
# store additional fields in additional_properties
78+
for _key in obj.keys():
79+
if _key not in cls.__properties:
80+
_obj.additional_properties[_key] = obj.get(_key)
81+
7082
return _obj
7183

7284

0 commit comments

Comments
 (0)