Skip to content

Conversation

@adamthom-amzn
Copy link
Contributor

Description of changes:
Endpoints can have paths (notable example: API Gateway REST APIs without a
custom domain name), and serialization of REST-JSON requests was ignoring
these paths even though it's available from the endpoint provider.

Tested this locally against a APIGateway REST API with SigV4 that was broken without it.

This will also impact JS client generation for every REST-JSON service. We have a couple such changes out right now, was going to submit a regeneration PR when all of those land.

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

@adamthom-amzn adamthom-amzn requested review from a team, JordonPhillips and gosar June 25, 2021 17:58
+ " context: $L\n"
+ "): Promise<$T> => {", "}", methodName, inputType, contextType, requestType, () -> {

// Get the hostname, port, and scheme from client's resolved endpoint. Then construct the request from
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: basePath

// Always write the bound path, but only the actual segments.
writer.write("let resolvedPath = $S;", "/" + trait.getUri().getSegments().stream()
writer.write("let resolvedPath = `$L` + $S;",
"${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a unit test to add tests for these cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not that I can see, no.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like protocol tests let you specify a custom endpoint, so it should be testable there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Endpoints can have paths (notable example: API Gateway REST APIs without a
custom domain name), and serialization of REST-JSON requests was ignoring
these paths even though it's available from the endpoint provider.
@alexforsyth
Copy link
Contributor

Can you post the PR with changes to js sdk v3?

@JordonPhillips
Copy link
Contributor

I'm working on getting the pr up

Copy link
Contributor

@alexforsyth alexforsyth left a comment

Choose a reason for hiding this comment

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

+1

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