Skip to content

[V3.1.3 Backport] fix(bnf,schema): align idShort with Metamodel Constraint AASd-002#611

Open
sebbader-sap wants to merge 2 commits into
IDTA-01001-3-1-3_workingfrom
backport/v3.1.3/pr580-idshort-constraint
Open

[V3.1.3 Backport] fix(bnf,schema): align idShort with Metamodel Constraint AASd-002#611
sebbader-sap wants to merge 2 commits into
IDTA-01001-3-1-3_workingfrom
backport/v3.1.3/pr580-idshort-constraint

Conversation

@sebbader-sap
Copy link
Copy Markdown
Contributor

Backport from PR #580

This is a backport of the bugfix from PR #580 to the V3.1.3 release branch.

Original PR Description

This PR corrects the grammar and schema definitions for idShort to match IDTA-01001 Constraint AASd-002. The constraint requires that idShort contain "at least two characters and shall only feature letters, digits, hyphen and underscore; starting mandatory with a letter, and not ending with a hyphen."

Problem: Both the BNF grammar and JSON Schema regex previously made the trailing character group optional, allowing single-character identifiers and those ending with hyphens—both violations of the normative constraint.

Solution: Make the trailing character group mandatory:

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

Changes

  • Updated BNF grammar for idShort pattern
  • Fixed JSON Schema regex pattern
  • Updated OpenAPI schemas

Related

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.

2 participants