Skip to content

For fixed-width inputs, do not automatically calculate a missing check digit, unless actually told to #263

@terryburton

Description

@terryburton

We've focused a lot on reducing human error in recent releases, e.g. with the GS1 AI syntax linting.

One source of error that I'm aware of is users accidentally missing a digit in the input for a symbology that has fixed-width input (such as EAN-13) and not realising that a check digit has been automatically added.

Given the example of EAN-13, the current behaviour is:

Data Options Result Note
9520123456788 Validate check digit and generate
952012345678 Calculate check digit and generate Check digit calculation occurs automatically

In future, a new calculatecheck option will be introduced, and the behaviour will be changed to:

Data Options Result Note
9520123456788 Validate check digit and generate
952012345678 Error: EAN-13 must be 13 digits, or 12 with calculatecheck option Check digit calculation is no longer automatic
952012345678 calculatecheck Calculate the check digit (as told) and generate

There's a decision to be made over whether or not to silently ignore the new calculatecheck option when a full width input is already provided, option (1):

Data Options Result Note
9520123456788 calculatecheck Validate check digit and generate Ignore being asked to generate a check digit if it is already present

versus option (2):

Data Options Result Note
9520123456788 calculatecheck Error: EAN-13 must be 12 digits with calculatecheck option

My preference is option (2) since this covers the case that a user wants their check digit to be calculated but erroneously enters 13 digits (and the check calculation happens to pass).

The above is an "API change" that maximises the utility of the check digit that is built into these fixed-width symbologies (and their derivatives):

  • ean13
  • ean8
  • upca
  • upce
  • isbn
  • ismn
  • issn
  • databarlimited
  • databaronni
  • databarstackedomni
  • databarstacked
  • databartruncated
  • sscc18
  • ean14
  • itf14
  • identcode
  • leitcode
  • pzn
  • code32

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions