VOC002 - Invalid Unit Code¶
Description¶
The unit code provided is not a valid UNECE Recommendation 20 code. Unit codes are used to specify measurement units for dimensions, weights, and other quantitative properties.
Severity¶
Warning
When This Occurs¶
unitfield indimensionscontains an invalid code- Unit code is not in UNECE Rec20 format
Example¶
{
"credentialSubject": {
"product": {
"dimensions": {
"weight": {
"value": 2.5,
"unit": "kilograms" // Invalid: should be "KGM"
}
}
}
}
}
Valid Format¶
UNECE Rec20 codes are typically 2-3 uppercase characters:
| Code | Unit | Description |
|---|---|---|
| KGM | Kilogram | Mass |
| MTR | Metre | Length |
| CMT | Centimetre | Length |
| LTR | Litre | Volume |
| MTK | Square metre | Area |
| CEL | Degree Celsius | Temperature |
Resolution¶
- Use correct UNECE Rec20 code:
- Verify unit code:
from dppvalidator.vocabularies import get_bundled_unit_codes
codes = get_bundled_unit_codes()
print("KGM" in codes) # True