Skip to content

Fix #471: Enforce correct format for GS1-128 trade measure AIs #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zipus
Copy link

@zipus zipus commented May 7, 2025

This pull request addresses Issue #471 regarding the incorrect parsing of trade measure Application Identifiers (AIs) in the gs1_128 module.

🔍 Problem
The parser was accepting invalid 3-digit AIs such as (310), which are not defined in the GS1 General Specifications. According to the GS1 standard, only AIs in the format (31nn), (32nn), (35nn), and (36nn) are valid for trade measures. For example, (3103) indicates net weight in kilograms with 3 decimal places — (310) is not valid.

Fix

  • Updated the parsing logic to strictly enforce the requirement for 4-digit AIs in the mentioned ranges.
  • Added doctests to validate both correct and incorrect formats.

📚 Reference
GS1 General Specifications – Release 25.0 (2025), Section 3.6.2 – page 166.

Please let me know if you'd like any adjustments or more test coverage.

@zipus zipus force-pushed the fix-471-gs1_128-ai-validation branch from 5b0a67e to 4b86b5a Compare May 7, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant