-
Notifications
You must be signed in to change notification settings - Fork 70
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
Remove reserved types #1052
Remove reserved types #1052
Conversation
Collision avoidance does not need for types to be reserved any more.
@miguel-vila, @kubukoz although my fix works and is actually much better in the grand scheme of things (no more reserved types), it has the annoying side effect of drastically impacting the UX for AWS clients, has AWS has the annoying tendency of redefining primitive types in all its specs : So I think we need to take action within this same unit of work to avoid this problem by means of a ProjectionTransformer that'd turn all simple shapes that are coming from aws-namespaces into references to the "standard" shapes (as long as the shapes we're transforming don't have any traits, and have the same names/shape-type as their targets). This ProjectionTransformer would be applied by default. @miguel-vila, if you want to pick this, it'd be greatly appreciated |
Do you think they have something similar in-house? If they use those specs to generate their SDK, that'd mean, for example, that the Dynamo client works with dynamo.String rather than java.lang.String? |
@daddykotex they don't have newtypes in house, so they always render the underlying type, which solves the problem (which obviously we don't want to do, because we have newtypes) |
@Baccata so the transformation would:
and it would be included as a default |
absolutely
yes |
I believe @denisrosca from my team will look into this next week. @Baccata given this is 0.17, I suppose you want to target this branch with the transformation PR, so that #1052 doesn't get released without that? |
Indeed I do |
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)
Flatten AWS newtypes
Remove the out-dated type-reservation list. The only things that are reserved are language keywords now.
Closes #1051