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

Unable to resolve @restJson1 trait #1101

Closed
jabalsad opened this issue Feb 19, 2022 · 3 comments
Closed

Unable to resolve @restJson1 trait #1101

jabalsad opened this issue Feb 19, 2022 · 3 comments

Comments

@jabalsad
Copy link

jabalsad commented Feb 19, 2022

We define our service with the @restJson1 trait:

namespace my.service
use aws.protocols#restJson1
@restJson1
service MyService {
   ...
}

However, when running the gradle build step, we see a message:

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: []

Similarly, in Visual Studio using the Smithy plugin, we get an error:

Unable to resolve trait `aws.protocols#restJson1`. If this is a custom trait, then it must be defined before it can be used in a model.Smithy LSP

Any idea how to fix this? See our build.gradle.kts file below:

plugins {
    java
    id("software.amazon.smithy").version("0.6.0")
}

repositories {
    mavenLocal()
    mavenCentral()
}

buildscript {
    dependencies {
        classpath("software.amazon.smithy:smithy-openapi:1.17.0")
        classpath("software.amazon.smithy.go:smithy-go-codegen:0.1.0")
        // classpath("software.amazon.smithy:smithy-aws-apigateway-openapi:1.11.0")
        // The openapi plugin configured in the smithy-build.json example below
        // uses the restJson1 protocol defined in the aws-traits package. This
        // additional dependency must added to use that protocol.
        classpath("software.amazon.smithy:smithy-aws-traits:1.17.0")
        classpath("software.amazon.smithy:smithy-cli:1.17.0")
    }
}

dependencies {
    implementation("software.amazon.smithy:smithy-model:1.17.0")
    implementation("software.amazon.smithy:smithy-aws-traits:1.17.0")
    implementation("software.amazon.smithy.go:smithy-go-codegen:0.1.0")
    implementation("software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.8.0")
}

configure<software.amazon.smithy.gradle.SmithyExtension> {
    // Uncomment this to use a custom projection when building the JAR.
    // projection = "foo"
}

// Uncomment to disable creating a JAR.
tasks["jar"].enabled = false
@mtdowling
Copy link
Member

This is for Go? 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

Just to confirm, we're currently publishing smithy-go-codegen to our own local Maven repository by checking out https://github.com/aws/smithy-go and running make smithy-publish-local, so the code generator works (for the most part). Is this what you are proposing or am I misunderstanding?

@mtdowling
Copy link
Member

No, I'm saying the implementation for restJson1 is in the AWS SDK repo and it's not on Maven central. Thanks for opening that ticket. That's where we should track this.

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

No branches or pull requests

2 participants