Package org.eclipse.microprofile.graphql
Annotation Interface NonNull
Specifies that the GraphQL type and/or input type represented by the Java
field this annotation is applied to must be marked as non-null in the schema.
For example, a user might annotate a class' property as such:
Note that all primitive fields/properties are automatically considered non-null unless they are also annotated with a
For example, a user might annotate a class' property as such:
@Type(name = "Starship", description = "A starship in StarWars") @Input(name = "StarshipInput", description = "Input type for a starship") public class Starship { private String id; @NonNull private String name; private float length; // getters/setters... }Schema generation of this would result in a stanza such as:
# A starship from Starwars type Starship { id: String name: String! length: Float! } # Input type for a starship input StarshipInput { # uuid of a new Starship id: String name: String! length: Float! }
Note that all primitive fields/properties are automatically considered non-null unless they are also annotated with a
DefaultValue
annotation.