Skip to content

fix(schema): align schema root with wrapped example format#72

Open
aorzelskiGH wants to merge 1 commit into
IDTA-01004-3-1_Workingfrom
fix/schema-root-wrapper
Open

fix(schema): align schema root with wrapped example format#72
aorzelskiGH wants to merge 1 commit into
IDTA-01004-3-1_Workingfrom
fix/schema-root-wrapper

Conversation

@aorzelskiGH
Copy link
Copy Markdown
Contributor

Summary

Aligns the root of aas-queries-and-access-rules-schema.json with
the wrapper format used consistently by every example under
partials/examples/*.json.

Problem

All shipped examples wrap their content in a top-level
"AllAccessPermissionRules" key:

{
  "AllAccessPermissionRules": {
    "rules": [ ... ]
  }
}

But the schema root was:

"$ref": "#/definitions/AllAccessPermissionRules"

which matches the inner object (the one whose rules is required),
not the outer wrapper. Consequently, none of the shipped examples
validate against the shipped schema out of the box.

Solution

Introduce a thin wrapper definition AccessRulesDocument with a
single required property AllAccessPermissionRules, and retarget the
root $ref:

"$ref": "#/definitions/AccessRulesDocument",
"definitions": {
  "AccessRulesDocument": {
    "type": "object",
    "required": ["AllAccessPermissionRules"],
    "properties": {
      "AllAccessPermissionRules": {
        "$ref": "#/definitions/AllAccessPermissionRules"
      }
    },
    "additionalProperties": false
  },
  ...
}

The internal shape of AllAccessPermissionRules is untouched.

Impact

  • Affected spec: IDTA-01004 (aas-specs-security)
  • No behavioural change for rule content; only the top-level shape
    expected by validators changes.
  • All existing examples now validate. Consumers that previously
    hand-stripped the wrapper must either wrap their payload or
    continue to validate against
    #/definitions/AllAccessPermissionRules directly.

Review notes

  • Please confirm the wrapper key and that no downstream tooling
    already validates the inner shape; if so, that is still
    reachable via $ref: "#/definitions/AllAccessPermissionRules".
  • The API spec (aas-specs-api) is intentionally not touched — the
    Query examples there are already unwrapped ({"$condition": …}),
    consistent with their schema root.

Related

Review Finding T-03: Schema/example wrapper mismatch.

All example files in partials/examples/*.json wrap their access-rule
document in a top-level "AllAccessPermissionRules" key, but the root
of aas-queries-and-access-rules-schema.json was set to validate the
inner rules object directly. As a result, none of the shipped examples
validated against the shipped schema.

This change introduces an "AccessRulesDocument" definition that
expects the wrapper and retargets the root $ref:

  "$ref": "#/definitions/AccessRulesDocument"

AccessRulesDocument:
  - required: ["AllAccessPermissionRules"]
  - AllAccessPermissionRules -> existing definition (unchanged)
  - additionalProperties: false

No change to the shape of "AllAccessPermissionRules" itself; all
existing rule content continues to validate unchanged.

Refs: Review Finding T-03
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