Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/validate_json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,15 @@ def validate_uuids(self) -> None:
# FK validation will catch missing brand
continue

# UUID is derived from GTIN; without GTIN (not required by the schema)
# the UUID can't be verified - it may be provided by the manufacturer.
gtin = package_data.get('gtin')
if gtin is None or 'uuid' not in package_data:
continue

try:
brand_uuid = uuid.UUID(brand_data['uuid'])
expected_uuid = generate_material_package_uuid(brand_uuid, package_data['gtin'])
expected_uuid = generate_material_package_uuid(brand_uuid, gtin)
is_valid = expected_uuid == uuid.UUID(package_data['uuid'])
if not is_valid:
self.errors.append(ValidationError(
Expand Down
Loading