-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
De-depude model components by location and value
While we previously de-duplicated models by filename/URL, we recently removed support for de-duping models by location and equality. This can happen, for example, when a Model is created through a ModelAssembler, and then added back to another ModelAssembler. If the files that came together to create the original model are added to the second ModelAssembler, then the previous file-base de-dupe would not catch the duplicate model and would fail in the assembler. This change updates the ModelAssembler to also de-dupe shapes, trait value, and metadata based on source location and equality. If one of these components conflict, and the conflcit is exactly the same, and defined at the same exact file/line/column, then the duplcate is ignored. Note that model components with no source location (i.e., weren't loaded from a file and were just created) are never deconflicted in this way because we don't reliably know that they are in fact the exact same unless we know where the components originate from.
- Loading branch information
Showing
4 changed files
with
58 additions
and
11 deletions.
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
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
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
6 changes: 6 additions & 0 deletions
6
smithy-model/src/test/resources/software/amazon/smithy/model/loader/dedupe-models.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,6 @@ | ||
metadata abc = [1] | ||
|
||
namespace smithy.example | ||
|
||
@tags(["a", "b"]) | ||
string MyString |