Search in sources :

Example 11 with ObjectTypeDefinition

use of graphql.language.ObjectTypeDefinition in project graphql-java by graphql-java.

the class SchemaDiff method synthOperationTypeDefinition.

// looks for a type called `Query|Mutation|Subscription` and if it exist then assumes it as an operation def
private Optional<OperationTypeDefinition> synthOperationTypeDefinition(Function<Type, Optional<ObjectTypeDefinition>> typeReteriver, String opName) {
    TypeName type = new TypeName(capitalize(opName));
    Optional<ObjectTypeDefinition> typeDef = typeReteriver.apply(type);
    return typeDef.map(objectTypeDefinition -> new OperationTypeDefinition(opName, type));
}
Also used : InputObjectTypeDefinition(graphql.language.InputObjectTypeDefinition) ObjectTypeDefinition(graphql.language.ObjectTypeDefinition) TypeName(graphql.language.TypeName) OperationTypeDefinition(graphql.language.OperationTypeDefinition)

Aggregations

ObjectTypeDefinition (graphql.language.ObjectTypeDefinition)11 InputObjectTypeDefinition (graphql.language.InputObjectTypeDefinition)10 InterfaceTypeDefinition (graphql.language.InterfaceTypeDefinition)8 TypeDefinition (graphql.language.TypeDefinition)8 UnionTypeDefinition (graphql.language.UnionTypeDefinition)8 EnumTypeDefinition (graphql.language.EnumTypeDefinition)7 ScalarTypeDefinition (graphql.language.ScalarTypeDefinition)7 OperationTypeDefinition (graphql.language.OperationTypeDefinition)6 Type (graphql.language.Type)6 TypeName (graphql.language.TypeName)6 List (java.util.List)6 Map (java.util.Map)6 GraphQLError (graphql.GraphQLError)5 Directive (graphql.language.Directive)5 EnumValueDefinition (graphql.language.EnumValueDefinition)5 FieldDefinition (graphql.language.FieldDefinition)5 InputValueDefinition (graphql.language.InputValueDefinition)5 Optional (java.util.Optional)5 Collectors (java.util.stream.Collectors)5 ArrayList (java.util.ArrayList)4