fix(schema): add missing definitions (ReferenceIdentifier, IdentifiableIdentifier, ReferableIdentifier, FragmentIdentifier, DescriptorIdentifier)#71
Open
aorzelskiGH wants to merge 1 commit into
Conversation
The access rule JSON schemas referenced five definitions that were not actually declared anywhere in the schema files, making the schemas formally invalid for any standard validator: - ReferenceIdentifier - IdentifiableIdentifier - ReferableIdentifier - FragmentIdentifier - DescriptorIdentifier These definitions are now added to both partials/json/aas-queries-and-access-rules-schema.json partials/json/access-rule-model.json Each definition is a typed string with a pattern derived from the corresponding production in the Access Rules BNF (RouteObject, IdentifiableObject, ReferableObject, FragmentObject, DescriptorObject, ReferenceAttribute). No changes to the public JSON format for valid rules; previously any validator would error out before reaching rule content. Refs: Review Finding T-04 Made-with: Cursor
| }, | ||
| "DescriptorIdentifier": { | ||
| "type": "string", | ||
| "description": "Identifier for a Descriptor (AAS Descriptor, Submodel Descriptor) as used in OBJECTS DESCRIPTOR. Format: $aasdesc(\"...\") | $smdesc(\"...\") | same with wildcard \"*\".", |
| }, | ||
| "DescriptorIdentifier": { | ||
| "type": "string", | ||
| "description": "Identifier for a Descriptor (AAS Descriptor, Submodel Descriptor) as used in OBJECTS DESCRIPTOR. Format: $aasdesc(\"...\") | $smdesc(\"...\") | same with wildcard \"*\".", |
| }, | ||
| "DescriptorIdentifier": { | ||
| "type": "string", | ||
| "description": "Identifier for a Descriptor (AAS Descriptor, Submodel Descriptor) as used in OBJECTS DESCRIPTOR. Format: $aasdesc(\"...\") | $smdesc(\"...\") | same with wildcard \"*\".", |
| }, | ||
| "DescriptorIdentifier": { | ||
| "type": "string", | ||
| "description": "Identifier for a Descriptor (AAS Descriptor, Submodel Descriptor) as used in OBJECTS DESCRIPTOR. Format: $aasdesc(\"...\") | $smdesc(\"...\") | same with wildcard \"*\".", |
| "DescriptorIdentifier": { | ||
| "type": "string", | ||
| "description": "Identifier for a Descriptor (AAS Descriptor, Submodel Descriptor) as used in OBJECTS DESCRIPTOR. Format: $aasdesc(\"...\") | $smdesc(\"...\") | same with wildcard \"*\".", | ||
| "pattern": "^\\$(?:aasdesc|smdesc)\\((?:\"\\*\"|\"[^\"]*\")\\)$" |
| "DescriptorIdentifier": { | ||
| "type": "string", | ||
| "description": "Identifier for a Descriptor (AAS Descriptor, Submodel Descriptor) as used in OBJECTS DESCRIPTOR. Format: $aasdesc(\"...\") | $smdesc(\"...\") | same with wildcard \"*\".", | ||
| "pattern": "^\\$(?:aasdesc|smdesc)\\((?:\"\\*\"|\"[^\"]*\")\\)$" |
Collaborator
|
this pr is critical.
|
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
Adds the five JSON Schema definitions that the access rule schemas
reference via
$refbut never actually declare. Without them theschemas are formally invalid under draft-07 and every standard
validator (AJV,
jsonschema, etc.) fails before it can even look atrule content.
Affected definitions:
ReferenceIdentifier(used byattributeItem.REFERENCE)IdentifiableIdentifier(used byobjectItem.IDENTIFIABLE)ReferableIdentifier(used byobjectItem.REFERABLE)FragmentIdentifier(used byobjectItem.FRAGMENT)DescriptorIdentifier(used byobjectItem.DESCRIPTOR)Affected files:
documentation/IDTA-01004/modules/ROOT/partials/json/aas-queries-and-access-rules-schema.jsondocumentation/IDTA-01004/modules/ROOT/partials/json/access-rule-model.jsonEach definition is a typed string with a pattern derived from the
corresponding production in the authoritative BNF
(
partials/bnf/access-rules.bnf):RouteObject,IdentifiableObject,ReferableObject,FragmentObject,DescriptorObject, andReferenceAttribute.Problem
The schemas were unusable end-to-end. Any attempt to validate an
access rule document against these schemas errored out during
resolution of
$ref: "#/definitions/IdentifiableIdentifier"(and thefour other targets).
Solution
Declare the missing definitions with string patterns that match the
BNF surface syntax, e.g.:
IdentifiableIdentifier:^\$(?:aas|sm|cd)\((?:"\*"|"[^"]*")\)$ReferableIdentifier:^\$sme\((?:"\*"|"[^"]*")\)\.[^\s]+$DescriptorIdentifier:^\$(?:aasdesc|smdesc)\((?:"\*"|"[^"]*")\)$ReferenceIdentifier:$aas|$sm|$cd|$smeforms with#<Fields...>FragmentIdentifieris kept as a plainstringbecause<FragmentLiteral>is deliberately opaque in the BNF.Impact
now valid.
Review notes
IdentifiableIdentifierandReferenceIdentifierare sufficient; we intentionally kept thempermissive (no deep nesting of
$smepath) to avoid falsenegatives in existing examples.
FragmentIdentifieris intentionally under-constrained; werecommend tightening it together with a future normative
specification of
<FragmentLiteral>.Related
Review Finding T-04: JSON Schema referenced but not declared.