Annotation Interface Name


Allows users to name a field or argument in the GraphQL Schema

For example, a user might annotate a method's parameter as such:
 public class CharacterService {
     @Query("searchByName")
     public List<Character> getByName(
                      @Name("name")
                      @DefaultValue("Han Solo")
                      @Description("Name to search for") String characterName) {
         //...
     }
 }
 
Schema generation of this would result in a stanza such as:
 type Query {
         # Search characters by name
         # name: Name to search for. Default value: Han Solo.
         searchByName(name: String = "Han Solo"): [Character]
     }
 
Or a user might annotate a class' property as such:
 @Type("Starship")
 @Input("StarshipInput")
 @Description("A starship in Star Wars")
 public class Starship {
     @Name("uuid")
     @Description("uuid of a new Starship")
     private String id;
     private String name;
     private float length;

     // getters/setters...
 }
 
Schema generation of this would result in a stanza such as:
 # A starship in Star Wars
 input Starship {
   # uuid of a new Starship
   uuid: String
   name: String
   length: Float
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Element Details

    • value

      String value
      Returns:
      the name to use in the GraphQL schema.