Skip to content

fix(bnf,schema): align idShort with Metamodel Constraint AASd-002#580

Open
aorzelskiGH wants to merge 1 commit intoIDTA-01002-3-2_workingfrom
fix/idshort-aasd002-alignment
Open

fix(bnf,schema): align idShort with Metamodel Constraint AASd-002#580
aorzelskiGH wants to merge 1 commit intoIDTA-01002-3-2_workingfrom
fix/idshort-aasd002-alignment

Conversation

@aorzelskiGH
Copy link
Copy Markdown
Contributor

Summary

Aligns the idShort grammar and regex used by this spec with the
normative definition in IDTA-01001 Constraint AASd-002:

idShort shall consist of at least two characters and shall only
feature letters, digits, hyphen (-) and underscore (_); starting
mandatory with a letter, and not ending with a hyphen, i.e.
^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9_]+$.

Problem

Both the BNF and the JSON Schema / OpenAPI regex marked the trailing
character group optional:

  • BNF (<idShort>):
    ( L (( L | D | "_" | "-" )* ( L | D | "_" ))? )
  • Regex:
    [A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?

That allowed single-character idShorts (e.g. A) and, through the
* + optional group, idShorts whose trailing character group was
simply absent — both of which AASd-002 forbids.

Solution

Make the trailing character group mandatory so there is always at
least one "non-hyphen" character after the initial letter:

  • BNF:
    ( L ( L | D | "_" | "-" )* ( L | D | "_" ) )
  • Regex:
    [A-Za-z][A-Za-z0-9_-]*[A-Za-z0-9_]

Equivalent to AASd-002. Minimum length is now 2; a trailing hyphen
is disallowed.

Files touched (per repo):

  • aas-specs-api:
    • documentation/IDTA-01002-3/modules/ROOT/partials/bnf/grammar.bnf
    • documentation/IDTA-01002-3/modules/ROOT/partials/query-json-schema.json
    • documentation/IDTA-01002-3/modules/ROOT/pages/schema.adoc
    • Part2-API-Schemas/openapi.yaml
  • aas-specs-security:
    • documentation/IDTA-01004/modules/ROOT/partials/bnf/access-rules.bnf
    • documentation/IDTA-01004/modules/ROOT/partials/json/aas-queries-and-access-rules-schema.json
    • documentation/IDTA-01004/modules/ROOT/partials/json/formulas-and-logical-expressions.json

Impact

  • Affected specs: IDTA-01002 and IDTA-01004.
  • Strictly tightens the accepted set of idShorts; any idShort that is
    valid under AASd-002 remains valid here.
  • Single-letter idShorts and trailing-hyphen idShorts — which were
    always disallowed by AASd-002 but accepted by this spec — are now
    rejected, matching the Metamodel spec.
  • No runtime behaviour change for conforming AAS content.

Review notes

  • Please confirm no examples in the repo rely on single-letter or
    trailing-hyphen idShorts. A quick scan of partials/examples/
    found none.
  • Paired PR in the sister repo carries the identical BNF/regex
    change; both should land together.

Related

Review Finding T-06: idShort regex inconsistent with AASd-002.

IDTA-01001 Constraint AASd-002 normatively defines idShort as:

  ^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9_]+$

i.e. at least two characters, starting with a letter, not ending with
a hyphen. The BNF productions in grammar.bnf/access-rules.bnf and the
idShort-path regex in query-json-schema.json, schema.adoc and
openapi.yaml marked the trailing character group optional, so single-
character idShorts (e.g. "A") and trailing-hyphen idShorts (e.g.
"Ab-") were accepted.

Changes:

BNF (<idShort>):
  before: ( L (( L | D | "_" | "-" )* ( L | D | "_" ) )? )
  after:  ( L  ( L | D | "_" | "-" )* ( L | D | "_" ) )
  (L = letter, D = digit)

JSON-Schema / OpenAPI regex:
  before: [A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?
  after:  [A-Za-z][A-Za-z0-9_-]*[A-Za-z0-9_]

Equivalent to AASd-002 (min 2 chars, cannot end with hyphen).

Refs: Review Finding T-06
Made-with: Cursor
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