Skip to content

Commit a201aca

Browse files
authored
expose helper method to retrieve oneOf isntance (#1284)
1 parent 7f3b93e commit a201aca

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.generator/src/generator/templates/model_utils.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ class ModelComposed(OpenApiModel):
554554
"""Returns the string representation of the model"""
555555
return pprint.pformat(self.to_dict())
556556

557+
def get_oneof_instance(self):
558+
"""Returns the oneOf instance"""
559+
return self._composed_instances[0]
560+
557561
def __eq__(self, other):
558562
"""Returns true if both objects are equal"""
559563
if not isinstance(other, self.__class__):

src/datadog_api_client/model_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@ def to_str(self):
557557
"""Returns the string representation of the model"""
558558
return pprint.pformat(self.to_dict())
559559

560+
def get_oneof_instance(self):
561+
"""Returns the oneOf instance"""
562+
return self._composed_instances[0]
563+
560564
def __eq__(self, other):
561565
"""Returns true if both objects are equal"""
562566
if not isinstance(other, self.__class__):

0 commit comments

Comments
 (0)