gs1 / gs1-syntax-dictionary

GS1 Barcode Syntax Dictionary and Syntax Tests
Apache License 2.0
13 stars 1 forks source link

Revisiting dlpkey AIs #12

Closed KDean-Dolphin closed 3 months ago

KDean-Dolphin commented 4 months ago

After further discussion with @mgh128 and in light of his comment on the original issue, I think we should put back the "GS1 Digital Link attribute" flag on all primary keys.

Section 4.10 of the GS1 Digital Link Standard: URI Syntax includes the following (emphasis mine):

Note that ‘data attributes’ MAY include AIs that may also be used as primary keys, as defined in sections 4.3, 4.4. In any GS1 Digital Link URI there SHALL be exactly one primary key, followed by any key qualifiers relevant to that primary key as path elements. However, the GS1 General Specifications allow combinations of primary keys in a single data carrier. For example, it is possible to encode both a GTIN and a GIAI in a single element string within a data carrier (see the example in section 5.11). Where it is necessary to encode more than one primary key in a single GS1 Digital Link URI, one SHALL be used in the path and the remaining key(s) encoded in the query string as data attributes.

This too is not entirely correct; the first sentence should read, "Note that ‘data attributes’ MAY include AIs that may also be used as primary or secondary keys...".

Reviewing the syntax dictionary yet again, I find that the secondary keys for AI 01 have the flag set for AI 10 but not for 21, 22, and 235. We should put the flag back on all primary and secondary keys, and do a thorough review to ensure that the flag is correctly set or unset for all AIs.

terryburton commented 4 months ago

The "?" flag relates to AIs that are valid data attributes corresponding to the AIs defined in §4.10 "Data attributes" of the grammar.

My understanding is that the text is for the most part "mere commentary", with the rule specifying the intent. I don't believe that it is the intent of the quoted text to say that supplementary to the ABNF rules any key or potential key-qualifier is also a valid data attribute, only that it may be the case for some AIs such as (10).

If it becomes valid to include any of those AIs as data attributes in the future, i.e. they get tokens assigned in §4.10, then we can certainly reintroduce the flag.

KDean-Dolphin commented 4 months ago

That's reasonable.

terryburton commented 4 months ago

Having reviewed the GS1 DL URI specification we have a block:

gtinParameter = "gtin-code=" gtin-value itipParameter = "itip-code=" itip-value gmnParameter = "gmn-code=" gmn-value cpidParameter = "cpid-code=" cpid-value glnParameter = "gln-code=" gln-value payToParameter = "payTo-code=" payTo-value partyGlnParameter = "partyGln-code=" partyGln-value gsrnpParameter = "gsrnp-code=" gsrnp-value gsrnParameter = "gsrn-code=" gsrn-value gcnParameter = "gcn-code=" gcn-value ssccParameter = "sscc-code=" sscc-value gdtiParameter = "gdti-code=" gdti-value gincParameter = "ginc-code=" ginc-value gsinParameter = "gsin-code=" gsin-value graiParameter = "grai-code=" "0" grai-value giaiParameter = "giai-code=" giai-value

Which should likely be:

gtinParameter = gtin-code "=" gtin-value ...

Having noted this, I've reverted the trimming of the "?" flag on the corresponding AIs: https://github.com/gs1/gs1-syntax-dictionary/commit/9965ea27ba4a49ecbd16a83d7cb2621b241ae9aa

This is required in order to allow the Syntax Engine unit tests that are based on DL URI spec examples to pass.

terryburton commented 3 months ago

... Which should likely be:

gtinParameter = gtin-code "=" gtin-value ...

We are in agreement that the GS1 DL URI spec should be updated. Issue captured elsewhere.