-
Notifications
You must be signed in to change notification settings - Fork 653
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: handle error message field in structure deserializer #2889
Conversation
...ws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonShapeDeserVisitor.java
Outdated
Show resolved
Hide resolved
...ws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonShapeDeserVisitor.java
Outdated
Show resolved
Hide resolved
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.
I can understand why you might have gone about it this way, but you've pushed complexity into the runtime that should really be handled in codegen.
The real (generated) code change that needs to happen here is less complicated than what you have currently. Basically, if we had
case "message":
before, we should now just be able to have
case "message", "Message":
That's going to be of significantly less runtime complexity than what you have currently.
fixes: #2859
Error messages from AWS services can be returned with inconsistent casing (
message
orMessage
).This change updates the error deserialization logic to handle case-insensitive message field matching.
Driver code setup:
This code uses a profile configuration that would assume a restricted role that does not have permissions to call ecs:CreateService. This will trigger an
AccessDeniedException
in the server's response that includes aMessage
field which breaks deserialization since ECS modelsmessage
(lower case). The result is that the message is omitted from the error.Outputs:
Output after change: