Skip to content

Add client guidance for endpoint resolution#2941

Merged
sugmanue merged 1 commit intomainfrom
client-guidance-endpoints
Feb 25, 2026
Merged

Add client guidance for endpoint resolution#2941
sugmanue merged 1 commit intomainfrom
client-guidance-endpoints

Conversation

@JordonPhillips
Copy link
Contributor


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@JordonPhillips JordonPhillips requested a review from a team as a code owner January 22, 2026 13:18
@github-actions
Copy link
Contributor

This pull request does not contain a staged changelog entry. To create one, use the ./.changes/new-change command. For example:

./.changes/new-change --pull-requests "#2941" --type feature --description "Add client guidance for endpoint resolution"

Make sure that the description is appropriate for a changelog entry and that the proper feature type is used. See ./.changes/README or run ./.changes/new-change -h for more information.

@JordonPhillips JordonPhillips requested a review from kstich January 23, 2026 13:02
Comment on lines 3 to 4
Smithy clients need to know which server to connect to when making requests.
This server location is specified by a URI, called an **endpoint**. This guide
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This phrasing makes it sound like URI and endpoint are synonymous but the below interface shows that endpoints are more that simplify URIs.

Comment on lines 52 to 61
#### Context

Endpoints may require additional context that impacts the request outside of
setting the URI. This context carries metadata that tells the client how to
modify requests for this specific endpoint. For example, some AWS use-cases
require that additional headers be added to HTTP requests for certain endpoints.

```java
public static final Context.Key<Map<String, List<String>>> HEADERS = Context.key("Endpoint headers");
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: This is a departure from SRA where we recommended that HTTP headers be a first-class property of an endpoint. Why the change here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because Smithy is protocol agnostic and there should therefore be no coupling to protocols, even transport protocols like http. Smithy, for example, already has traits to support mqtt.

Comment on lines +8 to +22
## Progressive flexibility

For simple services using HTTP protocols, there may only be one URI to address.
When creating a Smithy client intended for such services, the obvious solution
to endpoint resolution is to expose a simple configuration option that takes the
entire URI.

As services scale, that simple configuration strategy may become cumbersome to
customers. Services with geographically-distributed deployment regions may wish
to have a simplified way to refer to those regions that customers can use as an
alternative. There may additionally be other factors that complicate endpoint
resolution, such as alternative endpoints dedicated to IPv6, cellular
architecture, operation-specific endpoints, and so on. To support these needs,
it is recommended that Smithy clients allow endpoint resolution to be flexible,
without sacrificing the ability to easily specify a URI.
Copy link
Contributor

Choose a reason for hiding this comment

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

Opinion: This section doesn't recommend or even mention using separate resolver/params interfaces for each service, which SRA does. I think we should maintain that recommendation and call it out in this document.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It isn't necessary, and it makes everything more complex than it needs to be. When I was working on that for smithy-python, it was a nightmare. You can make it extensible and safe at the cost of it being fiendishly tedious to extend, or you can give up and just add a blank-check codegen hook. Perhaps tolerable for AWS SDK teams, but nobody else.

Instead this recommends providing the entire request, the schema for that request (simplified version of the model), and the request context. With all of that there's really no need to have service-specific interfaces. This is how smithy-java works, and it's perfectly capable of handling even S3's complex endpoint resolution.

Comment on lines 129 to 131
To further simplify the common case of defining a static URI, it is recommended
to provide helper methods that implement the interface for common URI or URL
types.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: URLs are a strict subset of URIs and we don't mention the term URL anywhere else so mentioning it here feels out of place.

Comment on lines 182 to 186
## Usage

It is recommended to invoke the `EndpointResolver` in every operation call,
rather than only once upon client construction. This is because the endpoint can
vary based on the operation, or the parameters in the operation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Opinion: Given the interface and requirements defined above, it seems impossible to invoke an endpoint resolver only once upon client construction since there's no operation, resolver params, or context. I recommend dropping this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. Perhaps there's a better place for this, since I do think the need for per-operation resolution must be justified as it isn't the obvious path.

@JordonPhillips JordonPhillips force-pushed the client-guidance-endpoints branch from 914ed54 to c68801d Compare February 10, 2026 16:47
@JordonPhillips JordonPhillips force-pushed the client-guidance-endpoints branch 2 times, most recently from a20dcbe to c8a9336 Compare February 25, 2026 11:54
@JordonPhillips JordonPhillips force-pushed the client-guidance-endpoints branch from c8a9336 to fd3a60c Compare February 25, 2026 16:39
@sugmanue sugmanue merged commit 8164b06 into main Feb 25, 2026
16 checks passed
@sugmanue sugmanue deleted the client-guidance-endpoints branch February 25, 2026 17:49
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.

4 participants