fix(schema): use anyOf where BNF allows mixed inline and named groups#581
Open
aorzelskiGH wants to merge 1 commit into
Open
fix(schema): use anyOf where BNF allows mixed inline and named groups#581aorzelskiGH wants to merge 1 commit into
aorzelskiGH wants to merge 1 commit into
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 was referenced May 20, 2026
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.
Summary
Replaces
oneOfwithanyOfin exactly those places where the BNFuses concatenation (both variants may appear together) rather than
alternation (exactly one). Keeps
oneOfwhere the BNF is genuinelyXOR.
Problem
The BNF makes a deliberate distinction between "mix allowed" and
"exactly one":
But the JSON Schema used
oneOffor the CAT pairs too, making theschema strictly more restrictive than the grammar. A rule that lists
both inline
ATTRIBUTESand aUSEATTRIBUTESreference was legalper BNF and illegal per schema.
Solution
Change
oneOftoanyOfin exactly the CAT cases:ACL.{ATTRIBUTES, USEATTRIBUTES}AccessPermissionRule.{OBJECTS, USEOBJECTS}DEFATTRIBUTESitem{attributes, USEATTRIBUTES}Keep
oneOffor the XOR cases:AccessPermissionRule.{ACL, USEACL}AccessPermissionRule.{FORMULA, USEFORMULA}DEFOBJECTSitem{objects, USEOBJECTS}(grammar<ObjectGroup>is XOR:( A )* | ( B )*)SecurityQueryFilter.{CONDITION, USEFORMULA}Impact
additionally, documents that combine inline and named attribute/
object groups now validate.
Review notes
ObjectGroupgrammar is indeed intended as XOR(production line:
( <SingleObject> )* | ( <UseObjectGroup> )*)while the inline
OBJECTS:block inside<AccessPermissionRule>is intended as CAT. If both are meant to be CAT,
DEFOBJECTSshould also be flipped to
anyOf— trivial follow-up.USEATTRIBUTESin ACL vs thearray-of-stringin
DEFATTRIBUTESis a separate inconsistency and is notaddressed here.
Related
Review Finding T-13: XOR vs mix semantics between BNF and JSON
Schema.