Introduced buildObject2 to handle recursive object building
This commit is contained in:
@@ -9,3 +9,27 @@ def buildObject(keys, outputs, resolved):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return object
|
return object
|
||||||
|
|
||||||
|
|
||||||
|
def buildObject2(value, outputs, resolved):
|
||||||
|
|
||||||
|
if isinstance(value, dict):
|
||||||
|
|
||||||
|
if value.keys() == {"resolved"}:
|
||||||
|
return resolved[value["resolved"]]
|
||||||
|
|
||||||
|
if value.keys() == {"output"}:
|
||||||
|
return outputs[value["output"]]
|
||||||
|
|
||||||
|
return {
|
||||||
|
key: buildObject2(item, outputs, resolved)
|
||||||
|
for key, item in value.items()
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(value, list):
|
||||||
|
return [
|
||||||
|
buildObject2(item, outputs, resolved)
|
||||||
|
for item in value
|
||||||
|
]
|
||||||
|
|
||||||
|
return value
|
||||||
Reference in New Issue
Block a user