Resolve REST JSON modeled errors by shape name#742
Open
jonathan343 wants to merge 3 commits into
Open
Conversation
Strip namespaces and URI suffixes before resolving modeled errors using the service namespace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes REST JSON modeled error resolution when an error identifier contains a namespace that differs from the namespace in the generated model.
Error identifiers are now normalized to their shape name and resolved using the service namespace.
Background
Smithy 1.72.0 added a protocol test for error identifiers containing an unrecognized namespace in smithy-lang/smithy#3157.
The new test surfaced a failure in the Smithy dependency update from #739. We preserved the namespace received over the wire, causing the exact modeled error lookup to fail and return a generic
CallErrorinstead ofFooError.The REST JSON specification requires clients to ignore namespaces and URI suffixes when resolving error identifiers. This change applies that normalization before looking up the modeled error.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.