Skip to content

Resolve REST JSON modeled errors by shape name#742

Open
jonathan343 wants to merge 3 commits into
developfrom
fix/rest-json-error-namespace
Open

Resolve REST JSON modeled errors by shape name#742
jonathan343 wants to merge 3 commits into
developfrom
fix/rest-json-error-namespace

Conversation

@jonathan343

Copy link
Copy Markdown
Contributor

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 CallError instead of FooError.

Failed: Expected 'FooError' exception to be thrown, but received CallError: Unknown error for operation aws.protocoltests.restjson#GreetingWithErrors - status: 500 - id: aws.different.namespace#FooError

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.

Strip namespaces and URI suffixes before resolving modeled errors using
the service namespace.
@jonathan343 jonathan343 requested a review from a team as a code owner July 16, 2026 16:38
@jonathan343 jonathan343 changed the title fix(smithy-aws-core): ignore wire namespaces in JSON error codes Resolve REST JSON modeled errors by shape name. Jul 16, 2026
@jonathan343 jonathan343 changed the title Resolve REST JSON modeled errors by shape name. Resolve REST JSON modeled errors by shape name Jul 16, 2026
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.

1 participant