[V3.1.3 Backport] fix(schema): use anyOf where BNF allows mixed inline and named groups#612
Open
sebbader-sap wants to merge 2 commits into
Open
Conversation
The BNF distinguishes concatenation (mix allowed) from alternation
(XOR) for the pairs inline-group / named-group. Three pairs in the
JSON schemas were marked oneOf (XOR) even though the grammar is CAT.
Grammar references (access-rules.bnf / grammar.bnf):
<AttributeGroup> ::=
( <SingleAttribute> <ws> )*
( <UseAttributeGroup> <ws> )* -- CAT
<AccessPermissionRule> ::=
"ACCESSRULE:" ...
( <ACL> | <UseACL> ) <ws> -- XOR
"OBJECTS:" <ws>
( <SingleObject> <ws> )*
( <UseObjectGroup> <ws> )* -- CAT (inline, not <ObjectGroup>)
( "FORMULA:" ... | <UseFormula> ) -- XOR
Changes:
- ACL.{ATTRIBUTES, USEATTRIBUTES} oneOf -> anyOf
- AccessPermissionRule.{OBJECTS, USEOBJECTS} oneOf -> anyOf
- DEFATTRIBUTES item.{attributes, USEATTRIBUTES} oneOf -> anyOf
(only in aas-specs-security; API schema doesn't have USEATTRIBUTES
at DEFATTRIBUTES level.)
Kept as oneOf (XOR):
- AccessPermissionRule.{ACL, USEACL}
- AccessPermissionRule.{FORMULA, USEFORMULA}
- DEFOBJECTS item.{objects, USEOBJECTS}
- SecurityQueryFilter.{CONDITION, USEFORMULA}
Refs: Review Finding T-13
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport from PR #581
This is a backport of the bugfix from PR #581 to the V3.1.3 release branch.
Original PR Description
This PR addresses a mismatch between BNF grammar and JSON Schema validation. The BNF distinguishes between concatenation (allowing mixed variants) and alternation (exactly one), but the schemas incorrectly used
oneOffor concatenation cases.Changes Made:
oneOftoanyOffor three concatenation pairs:oneOffor true XOR scenarios (ACL/USEACL, FORMULA/USEFORMULA pairs)Impact: This relaxes schema validation to align with grammar specifications. Previously valid documents remain valid; additionally, documents combining inline and named groups now validate correctly.
Related