-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow examples for service level errors
This commit enables validating error examples for operations with errors that are bound to services. All services the operation with said example are bound to must bind the error.
- Loading branch information
Showing
3 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
3 changes: 3 additions & 0 deletions
3
...s/software/amazon/smithy/model/errorfiles/validators/examples-trait-service-errors.errors
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ERROR] ns.foo#WithError: Error parameters provided for operation without the `ns.foo#ServiceError` error: `Testing 2` | ExamplesTrait | ||
[ERROR] ns.foo#WithoutError: Error parameters provided for operation without the `ns.foo#OperationError` error: `Testing 3` | ExamplesTrait | ||
[ERROR] ns.foo#WithoutError: Error parameters provided for operation without the `ns.foo#ServiceError` error: `Testing 4` | ExamplesTrait |
109 changes: 109 additions & 0 deletions
109
...s/software/amazon/smithy/model/errorfiles/validators/examples-trait-service-errors.smithy
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
$version: "2" | ||
|
||
namespace ns.foo | ||
|
||
service ErrorBound { | ||
version: "2020-07-02" | ||
operations: [ | ||
WithError | ||
WithoutError | ||
] | ||
errors: [ServiceError] | ||
} | ||
|
||
service ErrorBound2 { | ||
version: "2020-07-02" | ||
operations: [ | ||
WithoutError2 | ||
] | ||
errors: [ServiceError2] | ||
} | ||
|
||
service NoError { | ||
version: "2020-07-02" | ||
operations: [ | ||
WithError | ||
WithoutError | ||
] | ||
} | ||
|
||
@examples([ | ||
{ | ||
"title": "Testing 1", | ||
"error": { | ||
"shapeId": "ns.foo#OperationError" | ||
"content": { | ||
"foo": "baz" | ||
} | ||
} | ||
} | ||
{ | ||
"title": "Testing 2" | ||
"error": { | ||
"shapeId": "ns.foo#ServiceError" | ||
"content": { | ||
"foo": "baz" | ||
} | ||
} | ||
} | ||
]) | ||
operation WithError { | ||
input := {} | ||
errors: [OperationError] | ||
} | ||
|
||
@examples([ | ||
{ | ||
"title": "Testing 3", | ||
"error": { | ||
"shapeId": "ns.foo#OperationError" | ||
"content": { | ||
"foo": "baz" | ||
} | ||
} | ||
} | ||
{ | ||
"title": "Testing 4" | ||
"error": { | ||
"shapeId": "ns.foo#ServiceError" | ||
"content": { | ||
"foo": "baz" | ||
} | ||
} | ||
} | ||
]) | ||
operation WithoutError { | ||
input := {} | ||
output := {} | ||
} | ||
|
||
@examples([ | ||
{ | ||
"title": "Testing 5" | ||
"error": { | ||
"shapeId": "ns.foo#ServiceError2" | ||
"content": { | ||
"foo": "baz" | ||
} | ||
} | ||
} | ||
]) | ||
operation WithoutError2 { | ||
input := {} | ||
output := {} | ||
} | ||
|
||
@error("client") | ||
structure ServiceError { | ||
foo: String | ||
} | ||
|
||
@error("client") | ||
structure ServiceError2 { | ||
foo: String | ||
} | ||
|
||
@error("client") | ||
structure OperationError { | ||
foo: String | ||
} |