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

RFC30: Add tests to ensure that serde attributes are not added to error types #2803

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

thomas-k-cameron
Copy link
Contributor

Motivation and Context

This is a sub-PR of #2615

During the development, I mistakenly added serde attributes to error related data types.

This tests ensures that error types are not added.

Test that this PR adds will pass without the serde attributes.

Description

Adds test on codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGeneratorTest.kt

Testing

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@thomas-k-cameron thomas-k-cameron requested review from a team as code owners June 22, 2023 08:28
@rcoh rcoh requested review from a team as code owners November 14, 2023 02:21
@jdisanti
Copy link
Collaborator

jdisanti commented Dec 6, 2023

During the development, I mistakenly added serde attributes to error related data types.

Were these mistakenly added to the error builders, or to the errors themselves?

@thomas-k-cameron
Copy link
Contributor Author

thomas-k-cameron commented Dec 7, 2023

During the development, I mistakenly added serde attributes to error related data types.

Were these mistakenly added to the error builders, or to the errors themselves?

This PR was a response to this #2637 PR.

I added serde attributes to some Error types, and I didn't realize it until you pointed out #2637 (comment) that it wasn't a part of the RFC.
I wanted to add a test to make sure that same mistake won't happen again :D

@thomas-k-cameron thomas-k-cameron changed the title Add tests to ensure that serde attributes are not added to error types RFC30: Add tests to ensure that serde attributes are not added to error types Dec 7, 2023
@jdisanti
Copy link
Collaborator

jdisanti commented Dec 9, 2023

OK. Looks good. I will approve and merge once CI passes.

@thomas-k-cameron thomas-k-cameron force-pushed the RFC30/tests branch 2 times, most recently from 74330c1 to 5863495 Compare December 9, 2023 02:52
…degen/core/smithy/generators/BuilderGeneratorTest.kt
…degen/core/smithy/generators/BuilderGeneratorTest.kt
@@ -86,6 +86,7 @@ class StructureGeneratorTest {
val credentials = model.lookup<StructureShape>("com.test#Credentials")
val secretStructure = model.lookup<StructureShape>("com.test#SecretStructure")
val structWithInnerSecretStructure = model.lookup<StructureShape>("com.test#StructWithInnerSecretStructure")
val error = model.lookup<StructureShape>("com.test#MyError")
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 added this to get the shape of an error.

@thomas-k-cameron
Copy link
Contributor Author

@jdisanti

Hey,

The CI returned an error but it's fixed now.
It seems like I mistakenly deleted a variable when I was resolving a merge conflict.

@rcoh
Copy link
Collaborator

rcoh commented Dec 20, 2023

this looks good. Should we also have some sort of test that looks at the generated Cargo.toml? Do we have that already?

@thomas-k-cameron
Copy link
Contributor Author

@rcoh

This test doesn't affect Cargo.toml.
It just checks if we are adding serde traits Error types, which I did by mistake in the past.

For a context, please check this comment.

@thomas-k-cameron
Copy link
Contributor Author

I just clicked Update branch.

I think this one can be merged once it passes the tests.

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