additional check for mp aggregation schema validation for nested object types
@@ -277,11 +277,13 @@ class ModelProgramMetadataValidationForm(forms.Form):
# check for nested objects - we are not allowing nested objects to keep the form
# generated from the schema by json-editor to not get complicated
nested_object_found = False
+ if 'type' in v and v['type'] == 'object':
+ # parent type is object - check child type is not object
for k_child, v_child in v.items():
if isinstance(v_child, dict):
if 'type' in v_child and v_child['type'] == 'object':
- msg = "Not a valid metadata schema. Nested objects are not allowed. " \
- "Attribute '{}' contains nested object"
+ msg = "Not a valid metadata schema. Nested object types are not allowed. " \
+ "Attribute '{}' contains nested object types"
msg = msg.format(k_child)
self.add_error(field_name, msg)
nested_object_found = True
