Skip to content

Commit 0b9132f

Browse files
p1-raNementon
authored andcommitted
e2e / update openapi.json and golden-record
1 parent 0d7b4b7 commit 0b9132f

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
@@ -2,6 +2,7 @@
22

33
from .a_model import AModel
44
from .a_model_with_properties_reference_that_are_not_object import AModelWithPropertiesReferenceThatAreNotObject
5+
from .a_model_with_indirect_reference_property import AModelWithIndirectReferenceProperty
56
from .all_of_sub_model import AllOfSubModel
67
from .an_all_of_enum import AnAllOfEnum
78
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
@@ -1533,6 +1533,21 @@
15331533
"AByteStream": {
15341534
"type": "string",
15351535
"format": "byte"
1536+
},
1537+
"AModelWithIndirectReferenceProperty": {
1538+
"title": "AModelWithIndirectReferenceProperty",
1539+
"type": "object",
1540+
"properties": {
1541+
"an_enum_indirect_ref": {
1542+
"$ref": "#/components/schemas/AnEnumDeeperIndirectReference"
1543+
}
1544+
}
1545+
},
1546+
"AnEnumDeeperIndirectReference": {
1547+
"$ref": "#/components/schemas/AnEnumIndirectReference"
1548+
},
1549+
"AnEnumIndirectReference": {
1550+
"$ref": "#/components/schemas/AnEnum"
15361551
}
15371552
}
15381553
}

0 commit comments

Comments
 (0)