@@ -416,8 +416,12 @@ def validate_metadata(json_record):
416
416
417
417
# Check for 'identifiers'
418
418
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." )
421
425
else :
422
426
for identifier in json_record ["identifiers" ]:
423
427
if (
@@ -490,25 +494,6 @@ def validate_metadata(json_record):
490
494
):
491
495
errors .append ("Each 'date' must have 'date' and 'dateType'." )
492
496
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
-
512
497
# Check for 'creators'
513
498
if "creators" not in json_record :
514
499
errors .append ("'creators' field is missing." )
0 commit comments