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

Aperta
#687 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
graphql, java, kotlin

Direzione di ricerca

Inizia dall’esempio di schema GraphQL e dalla gestione della direttiva @annotate per le interfacce generate, quindi esamina i test di generazione esistenti, se disponibili. Aggiungi un caso di regressione che copra le annotazioni su un’interfaccia e stabilisci se la generazione debba applicarle o segnalare l’uso non supportato; il lavoro è completato quando il comportamento è coperto e corrisponde all’esito scelto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Kotlin
Stelle
220
Fork
123
Merge medio
1g 6h
PR unite (30g)
23

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Netflix/dgs-codegen

Tutte le issue di Netflix/dgs-codegen

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.