Skip to content

Commit 5696079

Browse files
committed
e2e / update openapi.json and golden-record
1 parent 806df1e commit 5696079

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
""" Contains all the data models used in inputs/outputs """
22

33
from .a_model import AModel
4+
from .a_model_with_indirect_reference_property import AModelWithIndirectReferenceProperty
45
from .all_of_sub_model import AllOfSubModel
56
from .an_all_of_enum import AnAllOfEnum
67
from .an_enum import AnEnum
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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="AModelWithIndirectReferenceProperty")
9+
10+
11+
@attr.s(auto_attribs=True)
12+
class AModelWithIndirectReferenceProperty:
13+
""" """
14+
15+
an_enum_indirect_ref: Union[Unset, AnEnum] = UNSET
16+
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
17+
18+
def to_dict(self) -> Dict[str, Any]:
19+
an_enum_indirect_ref: Union[Unset, str] = UNSET
20+
if not isinstance(self.an_enum_indirect_ref, Unset):
21+
an_enum_indirect_ref = self.an_enum_indirect_ref.value
22+
23+
field_dict: Dict[str, Any] = {}
24+
field_dict.update(self.additional_properties)
25+
field_dict.update({})
26+
if an_enum_indirect_ref is not UNSET:
27+
field_dict["an_enum_indirect_ref"] = an_enum_indirect_ref
28+
29+
return field_dict
30+
31+
@classmethod
32+
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
33+
d = src_dict.copy()
34+
an_enum_indirect_ref: Union[Unset, AnEnum] = UNSET
35+
_an_enum_indirect_ref = d.pop("an_enum_indirect_ref", UNSET)
36+
if not isinstance(_an_enum_indirect_ref, Unset):
37+
an_enum_indirect_ref = AnEnum(_an_enum_indirect_ref)
38+
39+
a_model_with_indirect_reference_property = cls(
40+
an_enum_indirect_ref=an_enum_indirect_ref,
41+
)
42+
43+
a_model_with_indirect_reference_property.additional_properties = d
44+
return a_model_with_indirect_reference_property
45+
46+
@property
47+
def additional_keys(self) -> List[str]:
48+
return list(self.additional_properties.keys())
49+
50+
def __getitem__(self, key: str) -> Any:
51+
return self.additional_properties[key]
52+
53+
def __setitem__(self, key: str, value: Any) -> None:
54+
self.additional_properties[key] = value
55+
56+
def __delitem__(self, key: str) -> None:
57+
del self.additional_properties[key]
58+
59+
def __contains__(self, key: str) -> bool:
60+
return key in self.additional_properties

end_to_end_tests/openapi.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,21 @@
11941194
"properties": {
11951195
"inner": {"$ref": "#/components/schemas/model_reference_doesnt_match"}
11961196
}
1197+
},
1198+
"AModelWithIndirectReferenceProperty": {
1199+
"title": "AModelWithIndirectReferenceProperty",
1200+
"type": "object",
1201+
"properties": {
1202+
"an_enum_indirect_ref": {
1203+
"$ref": "#/components/schemas/AnEnumDeeperIndirectReference"
1204+
}
1205+
}
1206+
},
1207+
"AnEnumDeeperIndirectReference": {
1208+
"$ref": "#/components/schemas/AnEnumIndirectReference"
1209+
},
1210+
"AnEnumIndirectReference": {
1211+
"$ref": "#/components/schemas/AnEnum"
11971212
}
11981213
}
11991214
}

0 commit comments

Comments
 (0)