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

smithy-go does not provide support for @restJson1 protocol trait #354

Closed
jabalsad opened this issue Feb 25, 2022 · 4 comments
Closed

smithy-go does not provide support for @restJson1 protocol trait #354

jabalsad opened this issue Feb 25, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@jabalsad
Copy link

When generating Go code, I get this error:

Unable to find a protocol generator for my.service#MyService: The my.service#MyService service supports the following unsupported protocols [aws.protocols#restJson1]. The following protocol generators were found on the class path: []

I opened this issue: smithy-lang/smithy#1101 with the smithy repo, but I was redirected here.

The solution proposed was to:

The actual code generation for the restJson1 protocol, because it's an AWS protocol, comes from software.amazon.smithy:smithy-aws-go-codegen... which isn't published to Maven Central. Can you open this ticket on the smithy-go repo so they can either a) move the restJson1 codegen to smithy-go directly, or b) publish smithy-aws-go-codegen to Maven Central?

@jabalsad
Copy link
Author

Actually, I think this problem might be core to the issue we're facing. Besides the VSCode editor complaining that it cannot resolve the restJson1 trait, we also realize that the generated go client contains no implementation for serializing, deserializing and building the request/response cycles.

We've tried to implement these ourselves, but with no luck due to poor documentation. Any advice on how to go about solving this problem? This is a blocker for us.

@jasdel
Copy link
Contributor

jasdel commented Feb 26, 2022

Thanks for reaching out @jabalsad. Currently the smithy-go code generation is a basic smithy generator that does not yet have any protocol implementations. All protocol implementations are in the aws-sdk-go-v2's smithy code generation. This is one of the main reasons the smithy-go codegen has limited documentation is not published to maven central yet.

With that said, I think its reasonable to investigate moving the aws-sdk-go-v2 codegen implementation of awsRestJson1 to smithy-go as a opinionated generic REST JSON smithy protocol implementation. This most likely will require extracting/decoupling AWS specific traits, behavior, and AWS codegen utilities from the awsRestJson1 protocol implementation. This would be the first step to investigate at how tightly the awsRestJson1 protocol implementation s coupled with the AWS code generators.

The AwsRestJson1.java is the implementation of this protocol in the v2 SDK's codegen, which is basically just RestJsonProtocolGenerator. The smithy-go HttpBindingProtocolGenerator provides the bulk of the HTTP REST implementation with RestJsonProtocolGenerator defining mostly the JSON serde, and middleware.

@jasdel jasdel added the enhancement New feature or request label Feb 26, 2022
@jasdel jasdel changed the title Unable to resolve @restJson1 trait smithy-go does not provide support for @restJson1 protocol trait Feb 26, 2022
@jhecking
Copy link

jhecking commented Aug 2, 2022

I managed to build the smithy-aws-go-codegen and smithy-go-codegen packages and then use them to generate client Go code for the simple weather demo model.

Unfortunately, the generated code has a few dependencies on internal packages of the AWS SDK package, e.g.

api_client.go:	internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
internal/endpoints/endpoints.go:	endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2"

That makes the generated code pretty much unusable at the moment. On the other hand, it looks like maybe the effort required to generate code that's decoupled from the AWS SDK might not be that big?

@lucix-aws
Copy link
Contributor

lucix-aws commented Oct 3, 2023

This is true for every aws protocol right now, moving to #458.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants