Type alias Gs1Handling

Gs1Handling: "PARSE" | "VALIDATE_STRUCTURE" | "DECODE_STRUCTURE" | "VALIDATE_FULL" | "DECODE_FULL"

GS1 message handling options. The GS1 standard defines a a key-value format for business-centric data that can be encoded into many 1D and 2D barcode types. https://ref.gs1.org/standards/genspecs/

GS1 messages have two representations or formats: a human-readable format and a machine-readable format. The human-readable format uses parentheses to wrap the keys in each pair. For example, the string "(01)012345678901(37)02(3922)00278" contains three AI keys: 01, 37, and 3922. The corresponding values are 012345678901, 02, and 00278.

The machine-readable format uses the special ASCII \x1D character to terminate key-value pairs in the string in cases where the given key implies that the value is variable-length. The equivalent machine-readable string for the above example is "010123456789013702\x1D392200278". In the above example, the 01 AI key is fixed-length, so the \x1D character is not necessary. The 37 AI keys is variable-length, so the \x1D character is necessary after the value in the pair. The 3922 AI key is also variable-length, but it is the last pair in the message, so the \x1D character is not necessary at the end.

The character \x1D is UNPRINTABLE - this means that if you try to print or otherwise visualize a GS1 message containing the \x1D character, you may see a number of different results, depending on how the system handles unprintable characters. You may see a question mark, a box, an escape sequence, a space or nothing at all.

  • PARSE: This is the default. GS1 messages are converted to the machine-readable format per the GS1 spec (the special FNC1 character is converted to ASCII \x1D). The implied 01 AI key is prepended to DataBar results. No validation is performed.
  • VALIDATE_STRUCTURE: Same as PARSE. Additionally, messages containing unknown AI keys, or containing values that don't fulfill the length, character set or regex requirements for known keys, are rejected.
  • DECODE_STRUCTURE: Same as VALIDATE_STRUCTURE. Additionally, GS1 strings are converted to the human-readable format, instead (with parentheses used to wrap AI keys, e.g. "(01)123456789"). The \x1D character is never used in this representation.
  • VALIDATE_FULL: Includes all validations from VALIDATE_STRUCTURE. Additionally, GS1 messages which have missing or incompatible combinations of AI keys are rejected. Additionally, values are checked against a list of known linting rules, e.g. checksums are calculated and verified, dates are checked for validity, etc. Results that fail any of the linter rules are rejected. The complete set of linter rules from the GS1 Syntax Dictionary are implemented.
  • DECODE_FULL: Combines the validations of VALIDATE_FULL and the human-readable output format of DECODE_STRUCTURE.

Generated using TypeDoc