Skip to content

Commit

Permalink
Remove namespace from event id
Browse files Browse the repository at this point in the history
  • Loading branch information
rchache authored and mtdowling committed Jun 8, 2023
1 parent f83c207 commit 14c70c2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private List<ValidationEvent> createErrorViolations(ChangedShape<OperationShape>
if (!change.getOldShape().getErrors().contains(error)) {
events.add(
ValidationEvent.builder()
.id(getEventId() + "." + error)
.id(getEventId() + "." + error.getName())
.severity(Severity.WARNING)
.message(String.format(
"The `%s` error was added to the `%s` operation. This "
Expand All @@ -57,7 +57,6 @@ private List<ValidationEvent> createErrorViolations(ChangedShape<OperationShape>
+ "parameter to an operation).",
error, change.getShapeId()))
.shape(change.getNewShape())
.sourceLocation(change.getNewShape().getSourceLocation())
.build()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ private List<ValidationEvent> createErrorViolations(ChangedShape<OperationShape>
if (!change.getNewShape().getErrors().contains(error)) {
events.add(
ValidationEvent.builder()
.id(getEventId() + "." + error)
.id(getEventId() + "." + error.getName())
.severity(Severity.WARNING)
.message(String.format(
"The `%s` error was removed from the `%s` operation.",
error, change.getShapeId()))
.shape(change.getNewShape())
.sourceLocation(change.getNewShape().getSourceLocation())
.build()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void detectsAddedErrors() {
List<ValidationEvent> events = ModelDiff.compare(modelA, modelB);

assertThat(TestHelper.findEvents(events, "AddedOperationError").size(), equalTo(2));
assertThat(TestHelper.findEvents(events, "AddedOperationError.foo.baz#E1").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "AddedOperationError.foo.baz#E2").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "AddedOperationError.E1").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "AddedOperationError.E2").size(), equalTo(1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void detectsRemovedErrors() {

// Emits an event for each removal.
assertThat(TestHelper.findEvents(events, "RemovedOperationError").size(), equalTo(2));
assertThat(TestHelper.findEvents(events, "RemovedOperationError.foo.baz#E1").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedOperationError.foo.baz#E2").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedOperationError.E1").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedOperationError.E2").size(), equalTo(1));
assertThat(TestHelper.findEvents(events, "RemovedOperationError").get(0).toString(),
startsWith("[WARNING] foo.baz#Operation: The `foo.baz#E1` error was removed " +
"from the `foo.baz#Operation` operation. | RemovedOperationError"));
Expand Down

0 comments on commit 14c70c2

Please sign in to comment.