Skip to content

Commit

Permalink
Fixing AlertsManagement generation (need to check if parent in yaml i…
Browse files Browse the repository at this point in the history
…s of type object) (#533)

* checking if parent is of type object

* fixed pylint
  • Loading branch information
iscai-msft authored Apr 1, 2020
1 parent c6fe796 commit 3f67779
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions autorest/codegen/models/object_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def fill_instance_from_yaml(self, namespace: str, yaml_data: Dict[str, Any], **k
properties = []
base_model = None

name = yaml_data["language"]["python"]["name"]

# checking to see if there is a parent class and / or additional properties
if yaml_data.get("parents"):
immediate_parents = yaml_data["parents"]["immediate"]
Expand All @@ -113,7 +115,10 @@ def fill_instance_from_yaml(self, namespace: str, yaml_data: Dict[str, Any], **k
description="Unmatched properties from the message are deserialized to this collection."
)
)
elif immediate_parent["language"]["default"]["name"] != yaml_data["language"]["default"]["name"]:
elif (
immediate_parent["language"]["default"]["name"] != name and
immediate_parent['type'] == "object"
):
base_model = id(immediate_parent)

# checking to see if this is a polymorphic class
Expand All @@ -131,7 +136,7 @@ def fill_instance_from_yaml(self, namespace: str, yaml_data: Dict[str, Any], **k
]
# this is to ensure that the attribute map type and property type are generated correctly

name = yaml_data["language"]["python"]["name"]


description = yaml_data["language"]["python"]["description"]
is_exception = False
Expand Down

0 comments on commit 3f67779

Please sign in to comment.