Skip to content

Invalid parsing of trade measures: AIs (31nn, 32nn, 35nn, 36nn) in GS1-128 #471

@zipus

Description

@zipus

The GS1-128 parser currently accepts (310) as a valid Application Identifier (AI), which is non-conformant with the GS1 General Specifications. The correct AI is of the form (310n) where n is a digit from 0 to 9 indicating the number of decimal places in the net weight (in kilograms). For example, (3103) indicates 3 decimal places.


Expected Behavior

According to the GS1 Application Identifiers definitions, the AI must be exactly 4 digits long, in the format:


(310n) → Net weight in kilograms with `n` decimal places

Examples:

  • (3103) with value 000035 means 0.035 kg → valid
  • (310) with value 3000035invalid (no such AI defined)

The parser should reject (310) and raise a ValidationError.


Actual Behavior

Currently, the parser accepts this invalid format:


(01)98456789014533(310)3000035

...even though (310) is not defined in the GS1 standard as a valid AI. This could cause misinterpretation of data and undermine compliance with barcode validation in regulated supply chains.


Relevant GS1 Specification

  • GS1 General Specifications – Release 25.0 (2025)
  • Section 3.6.2: Trade Measures – AIs (31nn, 32nn, 35nn, 36nn), page 166
    • Quote: “Application Identifiers of the form 31nn specify trade item weight in kilograms.”
    • There is no AI (310), only AI (310n) with a fourth digit for precision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions