Skip to content

Commit

Permalink
Allow enum shapes as resource identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Feb 28, 2023
1 parent 86720ec commit 2fa5aea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void validateMapKey(Shape shape, ShapeId target, Model model, List<Valid
}

private void validateIdentifier(Shape shape, Shape target, List<ValidationEvent> events) {
if (target.getType() != ShapeType.STRING) {
if (target.getType() != ShapeType.STRING && target.getType() != ShapeType.ENUM) {
events.add(badType(shape, target, RelationshipType.IDENTIFIER, ShapeType.STRING));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
}
]
},
"ns.foo#Valid2": {
"type": "resource",
"identifiers": {
"a": {
"target": "ns.foo#MyEnum"
}
}
},
"ns.foo#Invalid1": {
"type": "resource",
"identifiers": {
Expand Down Expand Up @@ -67,6 +75,17 @@
},
"ns.foo#MyString": {
"type": "string"
},
"ns.foo#MyEnum": {
"type": "enum",
"members": {
"VALUE_1": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#enumValue": "Value1"
}
}
}
}
}
}

0 comments on commit 2fa5aea

Please sign in to comment.