Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ public List<ValidationEvent> validate(Model model) {
testOperationInput);

// Error test cases may use invalid inputs as the mechanism to trigger their error,
// so lower the severity before emitting.
if (testCase.getExpect().getError().isPresent()) {
for (ValidationEvent event : operationInputEvents) {
events.add(event.toBuilder().severity(Severity.WARNING).build());
// so lower the severity before emitting. All other events here should be raised to
// DANGER level as well.
for (ValidationEvent event : operationInputEvents) {
if (event.getSeverity() == Severity.WARNING
|| event.getSeverity() == Severity.NOTE
|| testCase.getExpect().getError().isPresent()) {
events.add(event.toBuilder().severity(Severity.DANGER).build());
}
} else {
events.addAll(operationInputEvents);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[WARNING] smithy.example#InvalidService: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait
[DANGER] smithy.example#InvalidService: The operationInput value for an endpoint test does not match the operation's input shape: Invalid structure member `fizz` found for `smithy.example#GetThingInput` | EndpointTestsTrait.smithy.example#GetThingInput.fizz
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$version: "2.0"

namespace smithy.example

use smithy.rules#endpointTests

service InvalidService {
version: "2022-01-01"
operations: [
GetThing
]
}

apply InvalidService @endpointTests({
version: "1.0"
testCases: [
{
params: { stringFoo: "c d", boolFoo: true }
operationInputs: [
{
operationName: "GetThing"
operationParams: { fizz: "something", buzz: "a buzz value" }
}
]
expect: {
endpoint: {
url: "https://example.com"
properties: {}
headers: {
single: ["foo"]
multi: ["foo", "bar", "baz"]
}
}
}
}
]
})

@readonly
operation GetThing {
input := {
buzz: String
fuzz: String
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[WARNING] smithy.example#InvalidService: This shape applies a trait that is unstable: smithy.rules#endpointTests | UnstableTrait
[WARNING] smithy.example#InvalidService: The operationInput value for an endpoint test does not match the operation's input shape: Missing required structure member `fizz` for `smithy.example#GetThingInput` | EndpointTestsTrait
[DANGER] smithy.example#InvalidService: The operationInput value for an endpoint test does not match the operation's input shape: Missing required structure member `fizz` for `smithy.example#GetThingInput` | EndpointTestsTrait
Loading