From efcc36e71abb9760e8a7ca8edf80f1e2707cc7ef Mon Sep 17 00:00:00 2001 From: jonathan343 Date: Thu, 16 Jul 2026 11:28:07 -0400 Subject: [PATCH 1/4] fix(smithy-aws-core): ignore wire namespaces in JSON error codes Strip namespaces and URI suffixes before resolving modeled errors using the service namespace. --- ...gfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json | 4 ++++ .../src/smithy_aws_core/utils.py | 5 +++-- .../tests/unit/aio/test_protocols.py | 10 ++++++++++ .../smithy-aws-core/tests/unit/test_utils.py | 19 ++++++++++++++++--- 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json diff --git a/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json new file mode 100644 index 000000000..504589690 --- /dev/null +++ b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json @@ -0,0 +1,4 @@ +{ + "type": "bugfix", + "description": "Fixed REST JSON modeled error resolution when response error identifiers use a different namespace." +} \ No newline at end of file diff --git a/packages/smithy-aws-core/src/smithy_aws_core/utils.py b/packages/smithy-aws-core/src/smithy_aws_core/utils.py index 940160e05..072df16c7 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/utils.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/utils.py @@ -22,9 +22,10 @@ def parse_error_code(code: str, default_namespace: str | None) -> ShapeID | None if not code: return None - code = code.split(":")[0] + code = code.split(":", 1)[0] if "#" in code: - return ShapeID(code) + parsed_namespace, code = code.rsplit("#", 1) + default_namespace = default_namespace or parsed_namespace if not code or not default_namespace: return None diff --git a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py index 689095823..cfceec1da 100644 --- a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py +++ b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py @@ -39,6 +39,10 @@ "com.test#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", "com.test#FooError", ), + ( + "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", + "com.test#FooError", + ), ("", None), (":", None), (None, None), @@ -76,6 +80,12 @@ def test_aws_error_identifier(header: str | None, expected: ShapeID | None) -> N }, "com.test#FooError", ), + ( + { + "__type": "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate" + }, + "com.test#FooError", + ), ({"code": "FooError"}, "com.test#FooError"), ({"code": "com.test#FooError"}, "com.test#FooError"), ( diff --git a/packages/smithy-aws-core/tests/unit/test_utils.py b/packages/smithy-aws-core/tests/unit/test_utils.py index 6927a2fce..3282b855f 100644 --- a/packages/smithy-aws-core/tests/unit/test_utils.py +++ b/packages/smithy-aws-core/tests/unit/test_utils.py @@ -64,6 +64,10 @@ def test_aws_json_document_discriminator( "com.test#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", "com.test#FooError", ), + ( + "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", + "com.test#FooError", + ), ("", None), (":", None), ], @@ -73,6 +77,15 @@ def test_parse_error_code(code: str, expected: ShapeID | None) -> None: assert actual == expected -def test_parse_error_code_without_default_namespace() -> None: - actual = parse_error_code("FooError", None) - assert actual is None +@pytest.mark.parametrize( + "code, expected", + [ + ("FooError", None), + ("com.test#FooError", "com.test#FooError"), + ], +) +def test_parse_error_code_without_default_namespace( + code: str, expected: ShapeID | None +) -> None: + actual = parse_error_code(code, None) + assert actual == expected From 70d8566fe842fb1a1f6a47ff6c3d56e6c2c38269 Mon Sep 17 00:00:00 2001 From: jonathan343 Date: Thu, 16 Jul 2026 12:49:56 -0400 Subject: [PATCH 2/4] add PR link --- ...ithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json index 504589690..77dd7265d 100644 --- a/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json +++ b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json @@ -1,4 +1,4 @@ { "type": "bugfix", - "description": "Fixed REST JSON modeled error resolution when response error identifiers use a different namespace." -} \ No newline at end of file + "description": "Fixed REST JSON modeled error resolution when response error identifiers use a different namespace. ([#742](https://github.com/smithy-lang/smithy-python/pull/742))" +} From 2e650f918ee78905444a278844b70b42f9f7655b Mon Sep 17 00:00:00 2001 From: jonathan343 Date: Thu, 16 Jul 2026 13:59:26 -0400 Subject: [PATCH 3/4] fix: resolve REST JSON modeled errors by shape name --- ...gfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json | 2 +- .../src/smithy_aws_core/aio/protocols.py | 11 +++ .../src/smithy_aws_core/utils.py | 3 +- .../tests/unit/aio/test_protocols.py | 84 ++++++++++++++++++- .../smithy-aws-core/tests/unit/test_utils.py | 2 +- ...ment-906ae181a50149ab9b8715cf77d02b86.json | 4 + .../src/smithy_http/aio/protocols.py | 25 +++++- 7 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 packages/smithy-http/.changes/next-release/smithy-http-enhancement-906ae181a50149ab9b8715cf77d02b86.json diff --git a/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json index 77dd7265d..592fe9080 100644 --- a/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json +++ b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-bugfix-2fbf8d3495794ec58ff3ff88e0a3caeb.json @@ -1,4 +1,4 @@ { "type": "bugfix", - "description": "Fixed REST JSON modeled error resolution when response error identifiers use a different namespace. ([#742](https://github.com/smithy-lang/smithy-python/pull/742))" + "description": "Fixed REST JSON modeled error resolution by matching error identifiers by shape name when wire and modeled namespaces differ. ([#742](https://github.com/smithy-lang/smithy-python/pull/742))" } diff --git a/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py b/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py index afaac61eb..68d2c2d01 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py @@ -166,6 +166,17 @@ def content_type(self) -> str: def error_identifier(self) -> HTTPErrorIdentifier: return self._error_identifier + def _resolve_error_id( + self, + *, + operation: APIOperation[Any, Any], + error_id: ShapeID, + ) -> ShapeID: + for error_schema in operation.error_schemas: + if error_schema.id.name == error_id.name: + return error_schema.id + return error_id + def create_event_publisher[ OperationInput: SerializeableShape, OperationOutput: DeserializeableShape, diff --git a/packages/smithy-aws-core/src/smithy_aws_core/utils.py b/packages/smithy-aws-core/src/smithy_aws_core/utils.py index 072df16c7..c4df8a170 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/utils.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/utils.py @@ -24,8 +24,7 @@ def parse_error_code(code: str, default_namespace: str | None) -> ShapeID | None code = code.split(":", 1)[0] if "#" in code: - parsed_namespace, code = code.rsplit("#", 1) - default_namespace = default_namespace or parsed_namespace + return ShapeID(code) if not code or not default_namespace: return None diff --git a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py index cfceec1da..1357c2d8a 100644 --- a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py +++ b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py @@ -10,6 +10,7 @@ AWSErrorIdentifier, AWSJSONDocument, AwsQueryClientProtocol, + RestJsonClientProtocol, ) from smithy_aws_core.traits import AwsQueryTrait from smithy_core.deserializers import ShapeDeserializer @@ -20,7 +21,7 @@ from smithy_core.schemas import APIOperation, Schema from smithy_core.serializers import ShapeSerializer from smithy_core.shapes import ShapeID, ShapeType -from smithy_core.traits import Trait +from smithy_core.traits import HTTPTrait, Trait from smithy_core.types import TypedProperties from smithy_http import Fields, tuples_to_fields from smithy_http.aio import HTTPRequest, HTTPResponse @@ -41,7 +42,7 @@ ), ( "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", - "com.test#FooError", + "com.other#FooError", ), ("", None), (":", None), @@ -84,7 +85,7 @@ def test_aws_error_identifier(header: str | None, expected: ShapeID | None) -> N { "__type": "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate" }, - "com.test#FooError", + "com.other#FooError", ), ({"code": "FooError"}, "com.test#FooError"), ({"code": "com.test#FooError"}, "com.test#FooError"), @@ -130,6 +131,14 @@ def test_aws_json_document_discriminator( shape_type=ShapeType.SERVICE, traits=[AwsQueryTrait(None)], ) +_REST_JSON_SERVICE_SCHEMA = Schema.collection( + id=ShapeID("com.test#RestJsonService"), + shape_type=ShapeType.SERVICE, +) +_CROSS_NAMESPACE_ERROR_SCHEMA = Schema.collection( + id=ShapeID("com.shared#CrossNamespaceError"), + traits=[Trait.new(id=ShapeID("smithy.api#error"), value="client")], +) _INVALID_ACTION_ERROR_SCHEMA = Schema.collection( id=ShapeID("com.test#InvalidActionError"), traits=[ @@ -170,6 +179,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: return cls(**kwargs) +class _CrossNamespaceError(ModeledError): + @classmethod + def deserialize(cls, deserializer: ShapeDeserializer) -> "_CrossNamespaceError": + deserializer.read_struct( + _CROSS_NAMESPACE_ERROR_SCHEMA, + consumer=lambda schema, de: None, + ) + return cls() + + def _operation_schema(name: str) -> Schema: return Schema( id=ShapeID(f"com.test#{name}"), @@ -177,6 +196,14 @@ def _operation_schema(name: str) -> Schema: ) +def _rest_json_operation_schema(name: str) -> Schema: + return Schema( + id=ShapeID(f"com.test#{name}"), + shape_type=ShapeType.OPERATION, + traits=[HTTPTrait({"method": "POST", "uri": "/", "code": 200})], + ) + + def _mock_operation( schema: Schema, *, @@ -188,6 +215,57 @@ def _mock_operation( return cast("APIOperation[Any, Any]", operation) +@pytest.mark.parametrize( + "headers, body", + [ + pytest.param( + [("x-amzn-errortype", "CrossNamespaceError")], + b"", + id="header-unqualified", + ), + pytest.param( + [("x-amzn-errortype", "com.shared#CrossNamespaceError")], + b"", + id="header-qualified", + ), + pytest.param( + [("content-type", "application/json")], + b'{"__type":"CrossNamespaceError"}', + id="body-unqualified", + ), + pytest.param( + [("content-type", "application/json")], + b'{"__type":"com.shared#CrossNamespaceError"}', + id="body-qualified", + ), + ], +) +async def test_rest_json_resolves_cross_namespace_modeled_error( + headers: list[tuple[str, str]], + body: bytes, +) -> None: + protocol = RestJsonClientProtocol(_REST_JSON_SERVICE_SCHEMA) + operation = _mock_operation( + _rest_json_operation_schema("FailingOperation"), + error_schemas=[_CROSS_NAMESPACE_ERROR_SCHEMA], + ) + + with pytest.raises(_CrossNamespaceError): + await protocol.deserialize_response( + operation=operation, + request=cast(HTTPRequest, Mock()), + response=HTTPResponse( + status=500, + fields=tuples_to_fields(headers), + body=body, + ), + error_registry=TypeRegistry( + {ShapeID("com.shared#CrossNamespaceError"): _CrossNamespaceError} + ), + context=TypedProperties(), + ) + + async def test_aws_query_serializes_base_request_shape() -> None: protocol = AwsQueryClientProtocol(_SERVICE_SCHEMA, "2020-01-08") request = protocol.serialize_request( diff --git a/packages/smithy-aws-core/tests/unit/test_utils.py b/packages/smithy-aws-core/tests/unit/test_utils.py index 3282b855f..785e7bf51 100644 --- a/packages/smithy-aws-core/tests/unit/test_utils.py +++ b/packages/smithy-aws-core/tests/unit/test_utils.py @@ -66,7 +66,7 @@ def test_aws_json_document_discriminator( ), ( "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", - "com.test#FooError", + "com.other#FooError", ), ("", None), (":", None), diff --git a/packages/smithy-http/.changes/next-release/smithy-http-enhancement-906ae181a50149ab9b8715cf77d02b86.json b/packages/smithy-http/.changes/next-release/smithy-http-enhancement-906ae181a50149ab9b8715cf77d02b86.json new file mode 100644 index 000000000..09e417061 --- /dev/null +++ b/packages/smithy-http/.changes/next-release/smithy-http-enhancement-906ae181a50149ab9b8715cf77d02b86.json @@ -0,0 +1,4 @@ +{ + "type": "enhancement", + "description": "Enabled HTTP binding protocols to resolve modeled response errors when wire identifiers do not exactly match registered shape IDs. ([#742](https://github.com/smithy-lang/smithy-python/pull/742))" +} diff --git a/packages/smithy-http/src/smithy_http/aio/protocols.py b/packages/smithy-http/src/smithy_http/aio/protocols.py index af32cee16..b52637300 100644 --- a/packages/smithy-http/src/smithy_http/aio/protocols.py +++ b/packages/smithy-http/src/smithy_http/aio/protocols.py @@ -23,6 +23,7 @@ from smithy_core.prelude import DOCUMENT from smithy_core.schemas import APIOperation from smithy_core.serializers import SerializeableShape +from smithy_core.shapes import ShapeID from smithy_core.traits import EndpointTrait, HTTPTrait from ..deserializers import HTTPResponseDeserializer @@ -185,15 +186,26 @@ async def _create_error( error_id = self.error_identifier.identify( operation=operation, response=response ) + if error_id is not None and error_id not in error_registry: + error_id = self._resolve_error_id( + operation=operation, + error_id=error_id, + ) if error_id is None and self._matches_content_type(response): if isinstance(response_body, bytearray): response_body = bytes(response_body) deserializer = self.payload_codec.create_deserializer(source=response_body) document = deserializer.read_document(schema=DOCUMENT) + document_error_id = document.discriminator + if document_error_id not in error_registry: + document_error_id = self._resolve_error_id( + operation=operation, + error_id=document_error_id, + ) - if document.discriminator in error_registry: - error_id = document.discriminator + if document_error_id in error_registry: + error_id = document_error_id if isinstance(response_body, SeekableBytesReader): response_body.seek(0) @@ -236,6 +248,15 @@ async def _create_error( is_retry_safe=is_throttle or is_timeout or None, ) + def _resolve_error_id( + self, + *, + operation: APIOperation[Any, Any], + error_id: ShapeID, + ) -> ShapeID: + """Resolve a response discriminator to its modeled error shape ID.""" + return error_id + def _matches_content_type(self, response: HTTPResponse) -> bool: if "content-type" not in response.fields: return False From 36e1b91f8e4d958b50163ea8e27d94138ad247a3 Mon Sep 17 00:00:00 2001 From: jonathan343 Date: Mon, 20 Jul 2026 15:34:27 -0400 Subject: [PATCH 4/4] Address PR feedback --- codegen/gradle/libs.versions.toml | 2 +- .../src/smithy_aws_core/utils.py | 2 +- .../tests/unit/aio/test_protocols.py | 90 +------------------ .../smithy-aws-core/tests/unit/test_utils.py | 19 +--- 4 files changed, 6 insertions(+), 107 deletions(-) diff --git a/codegen/gradle/libs.versions.toml b/codegen/gradle/libs.versions.toml index ef016432e..0bd58efd1 100644 --- a/codegen/gradle/libs.versions.toml +++ b/codegen/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] junit5 = "6.1.1" -smithy = "1.71.0" +smithy = "1.72.1" mockito = "5.23.0" test-logger-plugin = "4.0.0" spotbugs = "6.0.22" diff --git a/packages/smithy-aws-core/src/smithy_aws_core/utils.py b/packages/smithy-aws-core/src/smithy_aws_core/utils.py index c4df8a170..940160e05 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/utils.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/utils.py @@ -22,7 +22,7 @@ def parse_error_code(code: str, default_namespace: str | None) -> ShapeID | None if not code: return None - code = code.split(":", 1)[0] + code = code.split(":")[0] if "#" in code: return ShapeID(code) diff --git a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py index 1357c2d8a..689095823 100644 --- a/packages/smithy-aws-core/tests/unit/aio/test_protocols.py +++ b/packages/smithy-aws-core/tests/unit/aio/test_protocols.py @@ -10,7 +10,6 @@ AWSErrorIdentifier, AWSJSONDocument, AwsQueryClientProtocol, - RestJsonClientProtocol, ) from smithy_aws_core.traits import AwsQueryTrait from smithy_core.deserializers import ShapeDeserializer @@ -21,7 +20,7 @@ from smithy_core.schemas import APIOperation, Schema from smithy_core.serializers import ShapeSerializer from smithy_core.shapes import ShapeID, ShapeType -from smithy_core.traits import HTTPTrait, Trait +from smithy_core.traits import Trait from smithy_core.types import TypedProperties from smithy_http import Fields, tuples_to_fields from smithy_http.aio import HTTPRequest, HTTPResponse @@ -40,10 +39,6 @@ "com.test#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", "com.test#FooError", ), - ( - "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", - "com.other#FooError", - ), ("", None), (":", None), (None, None), @@ -81,12 +76,6 @@ def test_aws_error_identifier(header: str | None, expected: ShapeID | None) -> N }, "com.test#FooError", ), - ( - { - "__type": "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate" - }, - "com.other#FooError", - ), ({"code": "FooError"}, "com.test#FooError"), ({"code": "com.test#FooError"}, "com.test#FooError"), ( @@ -131,14 +120,6 @@ def test_aws_json_document_discriminator( shape_type=ShapeType.SERVICE, traits=[AwsQueryTrait(None)], ) -_REST_JSON_SERVICE_SCHEMA = Schema.collection( - id=ShapeID("com.test#RestJsonService"), - shape_type=ShapeType.SERVICE, -) -_CROSS_NAMESPACE_ERROR_SCHEMA = Schema.collection( - id=ShapeID("com.shared#CrossNamespaceError"), - traits=[Trait.new(id=ShapeID("smithy.api#error"), value="client")], -) _INVALID_ACTION_ERROR_SCHEMA = Schema.collection( id=ShapeID("com.test#InvalidActionError"), traits=[ @@ -179,16 +160,6 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: return cls(**kwargs) -class _CrossNamespaceError(ModeledError): - @classmethod - def deserialize(cls, deserializer: ShapeDeserializer) -> "_CrossNamespaceError": - deserializer.read_struct( - _CROSS_NAMESPACE_ERROR_SCHEMA, - consumer=lambda schema, de: None, - ) - return cls() - - def _operation_schema(name: str) -> Schema: return Schema( id=ShapeID(f"com.test#{name}"), @@ -196,14 +167,6 @@ def _operation_schema(name: str) -> Schema: ) -def _rest_json_operation_schema(name: str) -> Schema: - return Schema( - id=ShapeID(f"com.test#{name}"), - shape_type=ShapeType.OPERATION, - traits=[HTTPTrait({"method": "POST", "uri": "/", "code": 200})], - ) - - def _mock_operation( schema: Schema, *, @@ -215,57 +178,6 @@ def _mock_operation( return cast("APIOperation[Any, Any]", operation) -@pytest.mark.parametrize( - "headers, body", - [ - pytest.param( - [("x-amzn-errortype", "CrossNamespaceError")], - b"", - id="header-unqualified", - ), - pytest.param( - [("x-amzn-errortype", "com.shared#CrossNamespaceError")], - b"", - id="header-qualified", - ), - pytest.param( - [("content-type", "application/json")], - b'{"__type":"CrossNamespaceError"}', - id="body-unqualified", - ), - pytest.param( - [("content-type", "application/json")], - b'{"__type":"com.shared#CrossNamespaceError"}', - id="body-qualified", - ), - ], -) -async def test_rest_json_resolves_cross_namespace_modeled_error( - headers: list[tuple[str, str]], - body: bytes, -) -> None: - protocol = RestJsonClientProtocol(_REST_JSON_SERVICE_SCHEMA) - operation = _mock_operation( - _rest_json_operation_schema("FailingOperation"), - error_schemas=[_CROSS_NAMESPACE_ERROR_SCHEMA], - ) - - with pytest.raises(_CrossNamespaceError): - await protocol.deserialize_response( - operation=operation, - request=cast(HTTPRequest, Mock()), - response=HTTPResponse( - status=500, - fields=tuples_to_fields(headers), - body=body, - ), - error_registry=TypeRegistry( - {ShapeID("com.shared#CrossNamespaceError"): _CrossNamespaceError} - ), - context=TypedProperties(), - ) - - async def test_aws_query_serializes_base_request_shape() -> None: protocol = AwsQueryClientProtocol(_SERVICE_SCHEMA, "2020-01-08") request = protocol.serialize_request( diff --git a/packages/smithy-aws-core/tests/unit/test_utils.py b/packages/smithy-aws-core/tests/unit/test_utils.py index 785e7bf51..6927a2fce 100644 --- a/packages/smithy-aws-core/tests/unit/test_utils.py +++ b/packages/smithy-aws-core/tests/unit/test_utils.py @@ -64,10 +64,6 @@ def test_aws_json_document_discriminator( "com.test#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", "com.test#FooError", ), - ( - "com.other#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate", - "com.other#FooError", - ), ("", None), (":", None), ], @@ -77,15 +73,6 @@ def test_parse_error_code(code: str, expected: ShapeID | None) -> None: assert actual == expected -@pytest.mark.parametrize( - "code, expected", - [ - ("FooError", None), - ("com.test#FooError", "com.test#FooError"), - ], -) -def test_parse_error_code_without_default_namespace( - code: str, expected: ShapeID | None -) -> None: - actual = parse_error_code(code, None) - assert actual == expected +def test_parse_error_code_without_default_namespace() -> None: + actual = parse_error_code("FooError", None) + assert actual is None