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

Added enum values to ids for ChangedEnumTrait events #1807

Merged
merged 2 commits into from
Jun 8, 2023

Conversation

rchache
Copy link
Contributor

@rchache rchache commented Jun 4, 2023

Issue #, if available:

Description of changes:
Adds the enum indices to the event ids
eg. ChangedEnumTrait.Removed.4

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 June 4, 2023 16:57
@@ -84,7 +84,7 @@ private List<ValidationEvent> validateEnum(ChangedShape<Shape> change, Pair<Enum
.severity(Severity.ERROR)
.message(String.format("Enum value `%s` was removed", definition.getValue()))
.shape(change.getNewShape())
.id(getEventId() + REMOVED)
.id(getEventId() + REMOVED + definition.getValue())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum values support arbitrary content, so this seems problematic to include them in the ID. Ideally these events would use the name of an enum definition if available, and if not... I dunno. Maybe the index of the entry? Or a name derived from the value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with always using the index if you think that's acceptable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sounds good. The caveat I can think of is that what is, say index 2, today won't be index 2 in the future if index 2 is removed. Not sure if that matters for you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be an issue since we only care about these events in the scope of a single Trebuchet feature and not after that

@mtdowling mtdowling merged commit cbe85ab into smithy-lang:main Jun 8, 2023
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.

3 participants