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

Fix ModifiedTrait for traits with breaking change rules #2249

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

syall
Copy link
Contributor

@syall syall commented Apr 19, 2024

Overview

Fix ModifiedTrait for traits with breaking change rules.

Before this change, if a trait had breaking change rules defined, the diff strategy in ModifiedTrait would eventually resolve the trait as unknown and produce a ModifiedTrait warning on any change.

Also, apply @tags(["diff.contents"]) to a structure member of the "all" ModifiedTrait test, which is a no-op.

Testing

Tested with @jsonName:

Model A:

$version: "2.0"

namespace ns.foo

structure Test {
    @jsonName("a")
    member: String
}

Model B:

$version: "2.0"

namespace ns.foo

structure Test {
    @jsonName("b")
    member: String
}

Diff events before the change (see duplicate ModifiedTrait event):

[ERROR] ns.foo#Test$member: Changed trait `smithy.api#jsonName` from `a` to `b` | TraitBreakingChange.Update.smithy.api#jsonName
[WARNING] ns.foo#Test$member: Changed trait `smithy.api#jsonName` from `a` to `b` | ModifiedTrait.Update.smithy.api#jsonName

Diff events after the change (no duplicate ModifiedTrait event):

[ERROR] ns.foo#Test$member: Changed trait `smithy.api#jsonName` from `a` to `b` | TraitBreakingChange.Update.smithy.api#jsonName

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

@syall syall marked this pull request as ready for review April 19, 2024 00:06
@syall syall requested a review from a team as a code owner April 19, 2024 00:06
@syall syall requested a review from kstich April 19, 2024 00:06
Copy link
Contributor

@gosar gosar left a comment

Choose a reason for hiding this comment

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

can we add a test case?

@syall syall force-pushed the fix-modified-trait-breaking-changes branch from e50fe3e to 3da8857 Compare April 19, 2024 02:54
@syall syall force-pushed the fix-modified-trait-breaking-changes branch from 3da8857 to fa44d1a Compare April 19, 2024 22:48
@syall syall merged commit 2883dc7 into smithy-lang:main Apr 19, 2024
13 checks passed
@syall syall deleted the fix-modified-trait-breaking-changes branch April 19, 2024 23:16
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.

None yet

2 participants