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

GraphQL interfaces should still be annotated when using the @annotate directive #687

Open
THE-ORONCO opened this issue Apr 29, 2024 · 0 comments

Comments

@THE-ORONCO
Copy link

Given an interface and a type, both of which have the @annotate directive placed on them, annotations are only generated for the GraphQL type.

For example (you can also find it as a cloneable repo):

interface TestInterface @annotate(name: "com.example.badinterfacegeneration.TestAnnotation") {
    name: String! @annotate(name: "com.example.badinterfacegeneration.TestAnnotation", target: "get")
}

type TestType @annotate(name: "com.example.badinterfacegeneration.TestAnnotation") {
    name: String! @annotate(name: "com.example.badinterfacegeneration.TestAnnotation", target: "get")
}

generates the following class:

@TestAnnotation
public class TestType {
  private String name;

  public TestType() {
  }

  public TestType(String name) {
    this.name = name;
  }

  @TestAnnotation
  public String getName() {
    return name;
  }
  // ... the rest of the generated code
}

and interface:

public interface TestInterface {
  String getName();

  void setName(String name);
}

The Interface does not have any annotations despite having them defined in the GraphQL schema. This is not the behaviour I expect. There should either be an error that indicates that annotations cannot be placed on interfaces or annotations should be placed on the generated interface.

I don't know how feasible this feature is to implement. If it is not possible, an addition to the documentation or a warning during generation would be nice.

@THE-ORONCO THE-ORONCO changed the title GraphQL Interfaces should still be annotated when using the @annotate directive GraphQL interfaces should still be annotated when using the @annotate directive Apr 29, 2024
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

1 participant