Skip to content

Commit 92b87c3

Browse files
authored
fixed resource reference (#98)
1 parent a100739 commit 92b87c3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

python/rpdk/python/templates/models.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ def _deserialize(
5757
{% endif %}
5858
return cls(
5959
{% for name, type in properties.items() %}
60-
{% if type.container == ContainerType.MODEL %}
61-
{{ name }}={{ type.type }}._deserialize(json_data.get("{{ name }}")),
62-
{% elif type.container == ContainerType.SET %}
63-
{{ name }}=set_or_none(json_data.get("{{ name }}")),
64-
{% elif type.container == ContainerType.LIST %}
60+
{% set container = type.container %}
61+
{% set resolved_type = type.type %}
62+
{% if container == ContainerType.MODEL %}
63+
{{ name }}={{ resolved_type }}._deserialize(json_data.get("{{ resolved_type }}")),
64+
{% elif container == ContainerType.SET %}
65+
{{ name }}=set_or_none(json_data.get("{{ resolved_type.type }}")),
66+
{% elif container == ContainerType.LIST %}
6567
{% if type | contains_model %}
66-
{{name}}=deserialize_list(json_data.get("{{ name }}"), {{name}}),
68+
{{name}}=deserialize_list(json_data.get("{{ resolved_type.type }}"), {{resolved_type.type}}),
6769
{% else %}
6870
{{ name }}=json_data.get("{{ name }}"),
6971
{% endif %}

0 commit comments

Comments
 (0)