@@ -416,8 +416,12 @@ def validate_metadata(json_record):
416416
417417 # Check for 'identifiers'
418418 if "identifiers" in json_record :
419- if not isinstance (json_record ["identifiers" ], list ):
420- errors .append ("'identifiers' should be a list." )
419+
420+ if (
421+ not isinstance (json_record ["identifiers" ], list )
422+ or len (json_record ["identifiers" ]) == 0
423+ ):
424+ errors .append ("'identifiers' should be a non-empty list." )
421425 else :
422426 for identifier in json_record ["identifiers" ]:
423427 if (
@@ -490,25 +494,6 @@ def validate_metadata(json_record):
490494 ):
491495 errors .append ("Each 'date' must have 'date' and 'dateType'." )
492496
493- # Check for 'identifiers'
494- if "identifiers" not in json_record :
495- errors .append ("'identifiers' field is missing." )
496- elif (
497- not isinstance (json_record ["identifiers" ], list )
498- or len (json_record ["identifiers" ]) == 0
499- ):
500- errors .append ("'identifiers' should be a non-empty list." )
501- else :
502- for identifier in json_record ["identifiers" ]:
503- if (
504- not isinstance (identifier , dict )
505- or "identifier" not in identifier
506- or "identifierType" not in identifier
507- ):
508- errors .append (
509- "Each 'identifier' must have 'identifier' and 'identifierType'."
510- )
511-
512497 # Check for 'creators'
513498 if "creators" not in json_record :
514499 errors .append ("'creators' field is missing." )
0 commit comments