-
Notifications
You must be signed in to change notification settings - Fork 8
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(go): AWS SDK shape namespace #769
Conversation
This reverts commit 2b9f006.
// Boolean to hold if shape is input or output of any operation | ||
boolean isTopLevelShape = model | ||
.shapes(OperationShape.class) | ||
.anyMatch(op -> | ||
op.getInput().filter(shape.getId()::equals).isPresent() || | ||
op.getOutput().filter(shape.getId()::equals).isPresent() | ||
); | ||
return isTopLevelShape ? sdkName : sdkName.concat("types"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not overload the method and pass this boolean only when required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if we do that every time we call smithyTypesNamespace
we will end-up doing a if-else check like below:
if (isShapeFromAWSSDK(shape)) {
smithyTypesNamespace(..., boolean flag);
} else {
smithyTypesNamespace(...);
}
Issue #, if available:
Description of changes:
Short description:
<serviceName>
if shape in aws sdk models is inside input and output of operationmodel
to the smithyTypeNamespace functionLong description:
All the shape which is input and output of operation is inside
github.com/aws/aws-sdk-go-v2/service/dynamodb
and all other inside those are ingithub.aaakk.us.kg/aws/aws-sdk-go-v2/service/dynamodb/types
. However, in currentmain-1.x
, smithyNameResolver return<serviceName>types
(example:dynamodbtypes
andkmstypes
) in every scenario which is wrong. Updates from this PR loops in the model's operation shape and if the shape belong to input/output of the operation shape and uses either types or module for the shapes.Note: We alias service/types module to types. For example:
github.com/aws/aws-sdk-go-v2/service/dynamodb/types
is aliased intodynamodbtypes
andgithub.aaakk.us.kg/aws/aws-sdk-go-v2/service/kms/types
intokmstypes
so that there won't be name collision.Test PR in MPL after bumping smithy-dafny to this branch: aws/aws-cryptographic-material-providers-library#1243
(No polymorph changes expected in MPL because none of the model in MPL depends on shape that are inside input and output of operation shape.)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.