Skip to content

Commit 8143ea5

Browse files
authored
Language transformation return empty objects (#2899)
1 parent 5bfc235 commit 8143ea5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cfnlint/template/transforms/_language_extensions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@ def _walk(self, item: Any, params: MutableMapping[str, Any], cfn: Any):
181181
# a sub object may be none or we have returned
182182
# an empty object. We don't want to remove empty
183183
# strings "" or 0 (zeros)
184-
if sub_value is None or sub_value == {}:
184+
# Remove `or sub_value == {}` for issue #2896
185+
if sub_value is None:
185186
del obj[k]
186187
else:
187-
obj[k] = self._walk(v, params, cfn)
188+
obj[k] = sub_value
188189
elif isinstance(obj, list):
189190
for i, v in enumerate(obj):
190191
obj[i] = self._walk(v, params, cfn)

0 commit comments

Comments
 (0)