Search in sources :

Example 11 with GraphQLNonNull

use of graphql.schema.GraphQLNonNull in project graphql-java by graphql-java.

the class Relay method mutation.

public GraphQLFieldDefinition mutation(String name, String fieldName, List<GraphQLInputObjectField> inputFields, List<GraphQLFieldDefinition> outputFields, DataFetcher dataFetcher) {
    GraphQLInputObjectType inputObjectType = newInputObject().name(name + "Input").fields(inputFields).build();
    GraphQLObjectType outputType = newObject().name(name + "Payload").fields(outputFields).build();
    return newFieldDefinition().name(fieldName).type(outputType).argument(newArgument().name("input").type(new GraphQLNonNull(inputObjectType))).dataFetcher(dataFetcher).build();
}
Also used : GraphQLInputObjectType(graphql.schema.GraphQLInputObjectType) GraphQLObjectType(graphql.schema.GraphQLObjectType) GraphQLNonNull(graphql.schema.GraphQLNonNull)

Aggregations

GraphQLNonNull (graphql.schema.GraphQLNonNull)11 GraphQLList (graphql.schema.GraphQLList)6 GraphQLInputObjectType (graphql.schema.GraphQLInputObjectType)4 GraphQLType (graphql.schema.GraphQLType)4 GraphQLArgument (graphql.schema.GraphQLArgument)3 GraphQLEnumType (graphql.schema.GraphQLEnumType)3 GraphQLObjectType (graphql.schema.GraphQLObjectType)3 Argument (graphql.language.Argument)2 GraphQLInterfaceType (graphql.schema.GraphQLInterfaceType)2 GraphQLScalarType (graphql.schema.GraphQLScalarType)2 Stack (java.util.Stack)2 AssertException (graphql.AssertException)1 GraphQLString (graphql.Scalars.GraphQLString)1 ArrayValue (graphql.language.ArrayValue)1 EnumValue (graphql.language.EnumValue)1 NullValue (graphql.language.NullValue)1 ObjectValue (graphql.language.ObjectValue)1 DataFetcher (graphql.schema.DataFetcher)1 DataFetchingEnvironment (graphql.schema.DataFetchingEnvironment)1 GraphQLDirective (graphql.schema.GraphQLDirective)1