Skip to content

Support endpoint trait host prefixes - #933

Merged
arandito merged 1 commit into
developfrom
hostprefix
Nov 12, 2026
Merged

arandito merged 1 commit into
developfrom
hostprefix

Conversation

@arandito

@arandito arandito commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds support for the @endpoint trait's hostPrefix and @hostLabel members across all protocols.

Added

  • The request pipeline expands the operation's host prefix once per call and prepends it to each attempt's resolved endpoint host before signing. The prefix also applies to a configured endpoint_uri.
  • HOST_PREFIX context property in smithy_core.endpoints, holding the expanded prefix.
  • An invalid or missing host label raises EndpointResolutionError before the request is sent.
  • disable_host_prefix_injection config field, generated only for services with @endpoint operations.
  • Codegen strips S3 Control's {AccountId}. host prefix, since its endpoint rules already place the account ID.

Removed (breaking, smithy-http)

  • HostPrefixSerializer and Binding.HOST. @hostLabel no longer changes where a member is serialized.
  • HTTPOperationSchemaMetadata.host_prefix and the endpoint_trait parameters on the HTTP serializers.
  • Reasoning: Host prefixes were previously only handled in the REST serializers and set_service_endpoint overwrote the host they built. The pipeline now handles host prefixes for every protocol. Additionally, the Smithy spec states that hostLabel must not affect a member's serialization.

Testing

  • Host prefix protocol tests and endpoint tests pass. They were xfailed before support was added.
  • Added unit test coverage for the new behavior.
  • Regenerated the existing clients plus S3 and S3 Control with this change. Their endpoint tests pass, including the previously xfailed S3 WriteGetObjectResponse and S3 Control {AccountId}. endpoint cases.

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 marked this pull request as ready for review November 12, 2026 15:00
@arandito
arandito requested a review from a team as a code owner November 12, 2026 15:00
from smithy_http.aio.aiohttp import AIOHTTPClient

from .._private.endpoints import BDD
from .._private.schemas import AWS_EC2

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.

AWS_EC2 is not defined or imported in ec2query._private.schemas

what's this warning about? isn't this the service schema, which should exist?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like a false positive that's already on develop. AWS_EC2 lives in a lazily loaded schema partition, which the static canonical-imports check doesn't check.

@arandito
arandito merged commit 6e64f58 into develop Nov 12, 2026
26 checks passed
@kuhe
kuhe deleted the hostprefix branch November 12, 2026 19:46
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