Skip to content

Add AWS QUERY protocol support#663

Open
arandito wants to merge 3 commits intosmithy-lang:feat/add-query-protocolfrom
arandito:add-query-protocol
Open

Add AWS QUERY protocol support#663
arandito wants to merge 3 commits intosmithy-lang:feat/add-query-protocolfrom
arandito:add-query-protocol

Conversation

@arandito
Copy link
Contributor

@arandito arandito commented Mar 19, 2026

Description

This PR adds awsQuery support: a new protocol generator and protocol-test projection, plus smithy-aws-core runtime client protocol support with URL form-encoded request serialization and modeled awsQueryError handling for awsQuery services.

It also includes supporting infrastructure changes: generated operation error schema registration, SigV4 protocol-test config for AWS protocol tests, and shared protocol-test handling for application/x-www-form-urlencoded bodies.

Note

This PR includes a couple changes that are directly ported from the currently open AWS JSON protocol PR #645. This PR will be rebased once the other is merged.

Testing

All supported protocol tests are passing. Tests in the explicit skip list remain skipped because they cover features that are not yet supported.

I was also able to generate a client for AWS STS from its Smithy service model and make a successful call:

STS test script

import asyncio

from smithy_aws_core.identity import EnvironmentCredentialsResolver

from aws_sdk_sts.client import STSClient
from aws_sdk_sts.config import Config
from aws_sdk_sts.models import GetCallerIdentityInput


async def main():
    client = STSClient(
        config=Config(
            endpoint_uri="https://sts.us-west-2.amazonaws.com",
            region="us-west-2",
            aws_credentials_identity_resolver=EnvironmentCredentialsResolver(),
        )
    )
    response = await client.get_caller_identity(GetCallerIdentityInput())

    print(response)


asyncio.run(main())

Output

> python test.py
/Users/aearanda/repos/github/smithy-python/packages/aws_sdk_signers/signers.py:794: AWSSDKWarning: Payload signing is enabled. This may result in decreased performance for large request bodies.
  warnings.warn(
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x106caa240>
GetCallerIdentityOutput(user_id='<REDACTED>', account='<REDACTED>', arn='<REDACTED>')

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@arandito arandito changed the base branch from develop to feat/add-query-protocol March 19, 2026 16:11
@arandito arandito force-pushed the add-query-protocol branch from b4369c1 to b9a4a2c Compare March 23, 2026 19:31
@arandito arandito marked this pull request as ready for review March 23, 2026 19:32
@arandito arandito requested a review from a team as a code owner March 23, 2026 19:32

def test_aws_query_resolves_modeled_error_from_query_error_trait() -> None:
protocol = AwsQueryClientProtocol(_SERVICE_SCHEMA, "2020-01-08")
error = getattr(protocol, "_create_error")(
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor testing thought: could these error cases go through deserialize_response() instead of calling _create_error via getattr?

Using getattr works around the private access check, but testing the public path may be cleaner. Generally we try to avoid accessing private attributes in tests to allow underlying code to change without affecting public behavior.

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