|
|
@@ -52,6 +52,24 @@ EXPECTED_FIELDS = { |
|
|
|
'spec': { |
|
|
|
'name': {'type': str}, |
|
|
|
'version': {'type': str}, |
|
|
|
'duplicate-consistency': { |
|
|
|
'type': dict, |
|
|
|
'optional': True, |
|
|
|
'spec': { |
|
|
|
'source_namespace': {'type': str}, |
|
|
|
'target_namespace': {'type': str}, |
|
|
|
'files': { |
|
|
|
'type': list, |
|
|
|
'elements': { |
|
|
|
'type': dict, |
|
|
|
'spec': { |
|
|
|
'source_file': {'type': str}, |
|
|
|
'target_file': {'type': str}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
@@ -68,14 +86,15 @@ SIGNATURE_FIELDS = { |
|
|
|
|
|
|
|
def check_spec(metadata, spec): |
|
|
|
for field, props in spec: |
|
|
|
if field not in metadata: |
|
|
|
if field not in metadata and 'optional' not in props: |
|
|
|
raise AssertionError("Field '{}' not present.".format(field)) |
|
|
|
|
|
|
|
# validate element |
|
|
|
check_element(field, metadata[field], props) |
|
|
|
if field in metadata: |
|
|
|
check_element(field, metadata[field], props) |
|
|
|
|
|
|
|
# delete it to detect extras |
|
|
|
del metadata[field] |
|
|
|
# delete it to detect extras |
|
|
|
del metadata[field] |
|
|
|
|
|
|
|
# Done checking all specified fields, check if we have extras |
|
|
|
for field, value in metadata.items(): |
|
|
|