Skip to content

Commit

Permalink
Emit NOTE on ignored duplicate shape
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Apr 16, 2024
1 parent 0941511 commit 96ab93c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,15 @@ private boolean validateConflicts(ShapeId id, Shape built, Shape previous) {
previous.getSourceLocation(), joiner.toString()));
return false;
} else if (!LoaderUtils.isSameLocation(built, previous)) {
LOGGER.warning(() -> "Ignoring duplicate but equivalent shape definition: " + id
+ " defined at " + built.getSourceLocation() + " and "
+ previous.getSourceLocation());
events.add(ValidationEvent.builder()
.id(Validator.MODEL_ERROR + ".IgnoredDuplicateDefinition")
.severity(Severity.NOTE)
.sourceLocation(previous.getSourceLocation())
.shapeId(id)
.message("Ignoring duplicate but equivalent shape definition: " + id
+ " defined at " + built.getSourceLocation() + " and "
+ previous.getSourceLocation())
.build());
}
}
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[NOTE] foo.baz#Foo: Ignoring duplicate but equivalent shape definition: foo.baz#Foo defined at | Model.IgnoredDuplicateDefinition
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$version: "2.0"

namespace foo.baz

@length(min: 1)
string Foo

@length(min: 1)
string Foo

0 comments on commit 96ab93c

Please sign in to comment.