Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed duplicate NoninclusiveTerms events #1975

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

rchache
Copy link
Contributor

@rchache rchache commented Sep 12, 2023

Description of changes:

Previously, the testcase

"smithy.api#examples": [ { "MasterUsername": "master" } ]

would produce the following ValidationEvents

[WARNING] ns.foo#A: 'examples' trait value at path {0/MasterUsername} contains a non-inclusive term `Master`. Consider using one of the following terms instead: `Main`, `Parent`, `Primary` | NoninclusiveTerms.Trait.master.examples.0/MasterUsername
[WARNING] ns.foo#A: 'examples' trait value at path {0/MasterUsername} contains a non-inclusive term `master`. Consider using one of the following terms instead: `main`, `parent`, `primary` | NoninclusiveTerms.Trait.master.examples.0/MasterUsername

Now, it will add /key to the TextIndex path when referencing a the key, to produce

[WARNING] ns.foo#A: 'examples' trait value at path {0/MasterUsername/key} contains a non-inclusive term `Master`. Consider using one of the following terms instead: `Main`, `Parent`, `Primary` | NoninclusiveTerms.Trait.master.examples.0/MasterUsername/key
[WARNING] ns.foo#A: 'examples' trait value at path {0/MasterUsername} contains a non-inclusive term `master`. Consider using one of the following terms instead: `main`, `parent`, `primary` | NoninclusiveTerms.Trait.master.examples.0/MasterUsername

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rchache rchache requested a review from a team as a code owner September 12, 2023 00:37
@kstich
Copy link
Contributor

kstich commented Sep 12, 2023

which seems more dangerous in my opinion.

What is dangerous about this approach? The portion of the id altered (.toLowerCase() call inside .id()) is done in this same case statement.

However, this approach may still be preferable since there's little difference in what to change here.

@rchache
Copy link
Contributor Author

rchache commented Sep 12, 2023

I believe changing (not extending) event ids of validation events is dangerous, as it could break consumers who have tests on the expected output events.

If that assumption was wrong, I'm actually perfectly happy to change it to

[WARNING] ns.foo#A: 'examples' trait value at path {0/MasterUsername} contains a non-inclusive term `Master`. Consider using one of the following terms instead: `Main`, `Parent`, `Primary` | NoninclusiveTerms.Trait.Master.examples.0/MasterUsername
[WARNING] ns.foo#A: 'examples' trait value at path {0/MasterUsername} contains a non-inclusive term `master`. Consider using one of the following terms instead: `main`, `parent`, `primary` | NoninclusiveTerms.Trait.master.examples.0/MasterUsername

@kstich kstich merged commit a2c54cb into smithy-lang:main Sep 14, 2023
@kstich kstich mentioned this pull request Sep 14, 2023
AndrewFossAWS pushed a commit to AndrewFossAWS/smithy that referenced this pull request Sep 20, 2023
* Fixed duplicate NoninclusiveTerms events

* Fix identical event ids for Noninclusive events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants