Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix server code generation of @httpPayload-bound constrained shapes #2584

Conversation

david-perez
Copy link
Contributor

The issue is we're not changing the return type of the payload
deserializing function to be the unconstrained type (e.g. the builder in
case of an @httpPayload-bound structure shape) when the shape is
constrained.

Yet another example of why code-generating constraints.smithy (see #2101)
is important.

Closes #2583.

Testing

The added integration test operation fails to compile without this patch.

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates

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

The issue is we're not changing the return type of the payload
deserializing function to be the unconstrained type (e.g. the builder in
case of an `@httpPayload`-bound structure shape) when the shape is
constrained.

Yet another example of why code-generating `constraints.smithy` (see #2101)
is important.

Closes #2583.
@david-perez david-perez added server Rust server SDK needs-client-review Generic client labels Apr 17, 2023
@david-perez david-perez marked this pull request as ready for review April 17, 2023 12:08
@david-perez david-perez requested review from a team as code owners April 17, 2023 12:09
Comment on lines +242 to +246
val outputT = if (member.isStreaming(model)) {
symbolProvider.toSymbol(member)
} else {
RuntimeType.ByteSlab.toSymbol()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an unrelated style change.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@ysaito1001 ysaito1001 removed the needs-client-review Generic client label Apr 18, 2023
…code-generation-of-httpPayload-bound-constrained-shapes
@david-perez david-perez added this pull request to the merge queue Apr 19, 2023
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Merged via the queue into main with commit 63a1e78 Apr 19, 2023
39 checks passed
@david-perez david-perez deleted the davidpz/fix-server-code-generation-of-httpPayload-bound-constrained-shapes branch April 19, 2023 10:12
unexge pushed a commit that referenced this pull request Apr 24, 2023
…#2584)

The issue is we're not changing the return type of the payload
deserializing function to be the unconstrained type (e.g. the builder in
case of an `@httpPayload`-bound structure shape) when the shape is
constrained.

Yet another example of why code-generating `constraints.smithy` (see
#2101)
is important.

Closes #2583.

## Testing

The added integration test operation fails to compile without this
patch.

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
rcoh pushed a commit that referenced this pull request Apr 24, 2023
…#2584)

The issue is we're not changing the return type of the payload
deserializing function to be the unconstrained type (e.g. the builder in
case of an `@httpPayload`-bound structure shape) when the shape is
constrained.

Yet another example of why code-generating `constraints.smithy` (see
#2101)
is important.

Closes #2583.

## Testing

The added integration test operation fails to compile without this
patch.

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Rust server SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@httpPayload-bound constrained shapes don't work in the server
4 participants