Skip to content

Commit 47adea9

Browse files
committed
e2e / update openapi.json and golden-record
1 parent c7da89e commit 47adea9

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

end_to_end_tests/golden-record/my_test_api_client/models/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from .a_model import AModel
44
from .a_model_with_indirect_reference_property import AModelWithIndirectReferenceProperty
5+
from .a_model_with_indirect_self_reference_property import AModelWithIndirectSelfReferenceProperty
56
from .all_of_sub_model import AllOfSubModel
67
from .an_all_of_enum import AnAllOfEnum
78
from .an_enum import AnEnum
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
from typing import Any, Dict, List, Type, TypeVar, Union
2+
3+
import attr
4+
5+
from ..models.an_enum import AnEnum
6+
from ..types import UNSET, Unset
7+
8+
T = TypeVar("T", bound="AModelWithIndirectSelfReferenceProperty")
9+
10+
11+
@attr.s(auto_attribs=True)
12+
class AModelWithIndirectSelfReferenceProperty:
13+
""" """
14+
15+
required_self_ref: AModelWithIndirectSelfReferenceProperty
16+
an_enum: Union[Unset, AnEnum] = UNSET
17+
optional_self_ref: Union[Unset, AModelWithIndirectSelfReferenceProperty] = UNSET
18+
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
19+
20+
def to_dict(self) -> Dict[str, Any]:
21+
required_self_ref = self.required_self_ref
22+
an_enum: Union[Unset, str] = UNSET
23+
if not isinstance(self.an_enum, Unset):
24+
an_enum = self.an_enum.value
25+
26+
optional_self_ref = self.optional_self_ref
27+
28+
field_dict: Dict[str, Any] = {}
29+
field_dict.update(self.additional_properties)
30+
field_dict.update(
31+
{
32+
"required_self_ref": required_self_ref,
33+
}
34+
)
35+
if an_enum is not UNSET:
36+
field_dict["an_enum"] = an_enum
37+
if optional_self_ref is not UNSET:
38+
field_dict["optional_self_ref"] = optional_self_ref
39+
40+
return field_dict
41+
42+
@classmethod
43+
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
44+
d = src_dict.copy()
45+
required_self_ref = d.pop("required_self_ref")
46+
47+
an_enum: Union[Unset, AnEnum] = UNSET
48+
_an_enum = d.pop("an_enum", UNSET)
49+
if not isinstance(_an_enum, Unset):
50+
an_enum = AnEnum(_an_enum)
51+
52+
optional_self_ref = d.pop("optional_self_ref", UNSET)
53+
54+
a_model_with_indirect_self_reference_property = cls(
55+
required_self_ref=required_self_ref,
56+
an_enum=an_enum,
57+
optional_self_ref=optional_self_ref,
58+
)
59+
60+
a_model_with_indirect_self_reference_property.additional_properties = d
61+
return a_model_with_indirect_self_reference_property
62+
63+
@property
64+
def additional_keys(self) -> List[str]:
65+
return list(self.additional_properties.keys())
66+
67+
def __getitem__(self, key: str) -> Any:
68+
return self.additional_properties[key]
69+
70+
def __setitem__(self, key: str, value: Any) -> None:
71+
self.additional_properties[key] = value
72+
73+
def __delitem__(self, key: str) -> None:
74+
del self.additional_properties[key]
75+
76+
def __contains__(self, key: str) -> bool:
77+
return key in self.additional_properties

end_to_end_tests/openapi.json

+23
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,29 @@
12091209
},
12101210
"AnEnumIndirectReference": {
12111211
"$ref": "#/components/schemas/AnEnum"
1212+
},
1213+
"AModelWithIndirectSelfReferenceProperty": {
1214+
"type": "object",
1215+
"properties": {
1216+
"an_enum": {
1217+
"$ref": "#/components/schemas/AnEnum"
1218+
},
1219+
"required_self_ref": {
1220+
"$ref": "#/components/schemas/AnDeeperIndirectSelfReference"
1221+
},
1222+
"optional_self_ref": {
1223+
"$ref": "#/components/schemas/AnDeeperIndirectSelfReference"
1224+
}
1225+
},
1226+
"required": [
1227+
"required_self_ref"
1228+
]
1229+
},
1230+
"AnDeeperIndirectSelfReference": {
1231+
"$ref": "#/components/schemas/AnIndirectSelfReference"
1232+
},
1233+
"AnIndirectSelfReference": {
1234+
"$ref": "#/components/schemas/AModelWithIndirectSelfReferenceProperty"
12121235
}
12131236
}
12141237
}

0 commit comments

Comments
 (0)