Skip to content

Resolve REST JSON modeled errors by shape name#742

Merged
jonathan343 merged 4 commits into
developfrom
fix/rest-json-error-namespace
Jul 20, 2026
Merged

Resolve REST JSON modeled errors by shape name#742
jonathan343 merged 4 commits into
developfrom
fix/rest-json-error-namespace

Conversation

@jonathan343

@jonathan343 jonathan343 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR fixes REST JSON modeled error resolution when a wire error identifier contains a namespace that differs from the modeled error's namespace.

After an exact lookup fails, REST JSON matches the identifier's shape name against the operation's modeled errors and uses the matched error's full shape ID.

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.

Testing

Updated Smithy from 1.71.0 to 1.72.1, enabling the protocol test introduced by smithy-lang/smithy#3157. All tests passed when running make test-protocols.


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
Comment thread packages/smithy-aws-core/tests/unit/aio/test_protocols.py Outdated
Comment thread packages/smithy-aws-core/tests/unit/aio/test_protocols.py Outdated
Comment thread packages/smithy-aws-core/tests/unit/aio/test_protocols.py Outdated
Comment thread packages/smithy-aws-core/tests/unit/aio/test_protocols.py Outdated

@arandito arandito left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@jonathan343
jonathan343 merged commit 55e8fef into develop Jul 20, 2026
10 checks passed
@jonathan343
jonathan343 deleted the fix/rest-json-error-namespace branch July 20, 2026 20:09
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.

2 participants