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

awsQueryError trait support #1283

Merged
merged 2 commits into from
Jun 3, 2021
Merged

Conversation

skmcgrail
Copy link
Member

Adds support for awsQueryError trait.

Requires aws/smithy-go#304

@skmcgrail
Copy link
Member Author

FYI the order of a handful of switch cases have changed in the regeneration, these are expected since this moved from a TreeSet on the ShapeId to a TreeMap where the stable sorting is on the key string now.

Comment on lines +161 to +175
Map<String, ShapeId> errors = new TreeMap<>();

operation.getErrors().forEach(shapeId -> {
Shape errorShape = context.getModel().expectShape(shapeId);
String errorName = shapeId.getName(context.getService());

Optional<AwsQueryErrorTrait> errorShapeTrait = errorShape.getTrait(AwsQueryErrorTrait.class);
if (errorShapeTrait.isPresent()) {
errors.put(errorShapeTrait.get().getCode(), shapeId);
} else {
errors.put(errorName, shapeId);
}
});

return errors;
Copy link
Contributor

@skotambkar skotambkar Jun 3, 2021

Choose a reason for hiding this comment

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

Should this map key, value pair be reversed?

I would have expected shapeId to be the key, while errorName or code is the value. Is errorName or errorCode guaranteed to be unique within all operation error shapes?

Copy link
Member Author

@skmcgrail skmcgrail Jun 3, 2021

Choose a reason for hiding this comment

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

Error name has to be unique cause it is the shapeId name by default. For query alias’s and whether those conflict that would be a question for smithy on whether they validate that constraint.

@skmcgrail skmcgrail merged commit 990263b into aws:main Jun 3, 2021
@skmcgrail skmcgrail deleted the awsQueryErrorTrait branch June 3, 2021 23:49
jrichard8 pushed a commit to jrichard8/aws-sdk-go-v2 that referenced this pull request Feb 14, 2022
* Support awsQueryError trait
* Regenerated Clients
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