-
Notifications
You must be signed in to change notification settings - Fork 69
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
Flatten AWS newtypes #1110
Flatten AWS newtypes #1110
Conversation
AWS in their smithy specs have a tendency to create newtypes for the smithy standard shapes. As part of this change, introduce a projection transformer that will run as a preprocessor before code generation and will replace the newtypes (if they match some criteria) with references to the standard smithy shapes. For a newtype to be considered as being "replaceable" it has to match the following criteria: - doesn't have any traits (other than @default) - is a simple shape - the name matches the smithy shape (one exception is Date, as it will be replaced with Timestamp even though it doesn't actually match). - comes from an AWS namespace (i.e. starts with com.amazonaws)
|
...les/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/src/main/scala/Main.scala
Show resolved
Hide resolved
modules/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/build.sbt
Outdated
Show resolved
Hide resolved
...les/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/src/main/scala/Main.scala
Show resolved
Hide resolved
modules/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/test
Outdated
Show resolved
Hide resolved
...les/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/src/main/scala/Main.scala
Outdated
Show resolved
Hide resolved
modules/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/test
Show resolved
Hide resolved
modules/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/build.sbt
Outdated
Show resolved
Hide resolved
modules/codegen/src/smithy4s/codegen/transformers/AwsStandardTypesTransformer.scala
Outdated
Show resolved
Hide resolved
Pretty good work overall :) |
Need some help figuring out the reason for the build failure. Unfortunately, I can't see the error message 🤔 |
@denisrosca, just sync your branch with the latest |
@Baccata we cool here? |
f042dd4
into
disneystreaming:remove-reserved-types
Thanks a lot for this ! |
AWS in their smithy specs have a tendency to create newtypes for the smithy standard shapes. As part of this change, introduce a projection transformer that will run as a preprocessor before code generation and will replace the newtypes (if they match some criteria) with references to the standard smithy shapes.
For a newtype to be considered as being "replaceable" it has to match the following criteria: