Search in sources :

Example 1 with INTERFACE

use of graphql.introspection.Introspection.DirectiveLocation.INTERFACE in project graphql-java by graphql-java.

the class SchemaTypeDirectivesChecker method checkTypeDirectives.

void checkTypeDirectives(List<GraphQLError> errors) {
    typeRegistry.objectTypeExtensions().values().forEach(extDefinitions -> extDefinitions.forEach(ext -> checkDirectives(OBJECT, errors, ext)));
    typeRegistry.interfaceTypeExtensions().values().forEach(extDefinitions -> extDefinitions.forEach(ext -> checkDirectives(INTERFACE, errors, ext)));
    typeRegistry.unionTypeExtensions().values().forEach(extDefinitions -> extDefinitions.forEach(ext -> checkDirectives(UNION, errors, ext)));
    typeRegistry.enumTypeExtensions().values().forEach(extDefinitions -> extDefinitions.forEach(ext -> checkDirectives(ENUM, errors, ext)));
    typeRegistry.scalarTypeExtensions().values().forEach(extDefinitions -> extDefinitions.forEach(ext -> checkDirectives(SCALAR, errors, ext)));
    typeRegistry.inputObjectTypeExtensions().values().forEach(extDefinitions -> extDefinitions.forEach(ext -> checkDirectives(INPUT_OBJECT, errors, ext)));
    typeRegistry.getTypes(ObjectTypeDefinition.class).forEach(typeDef -> checkDirectives(OBJECT, errors, typeDef));
    typeRegistry.getTypes(InterfaceTypeDefinition.class).forEach(typeDef -> checkDirectives(INTERFACE, errors, typeDef));
    typeRegistry.getTypes(UnionTypeDefinition.class).forEach(typeDef -> checkDirectives(UNION, errors, typeDef));
    typeRegistry.getTypes(EnumTypeDefinition.class).forEach(typeDef -> checkDirectives(ENUM, errors, typeDef));
    typeRegistry.getTypes(InputObjectTypeDefinition.class).forEach(typeDef -> checkDirectives(INPUT_OBJECT, errors, typeDef));
    typeRegistry.scalars().values().forEach(typeDef -> checkDirectives(SCALAR, errors, typeDef));
    List<Directive> schemaDirectives = SchemaExtensionsChecker.gatherSchemaDirectives(typeRegistry, errors);
    // we need to have a Node for error reporting so we make one in case there is not one
    SchemaDefinition schemaDefinition = typeRegistry.schemaDefinition().orElse(SchemaDefinition.newSchemaDefinition().build());
    checkDirectives(DirectiveLocation.SCHEMA, errors, typeRegistry, schemaDefinition, "schema", schemaDirectives);
    Collection<DirectiveDefinition> directiveDefinitions = typeRegistry.getDirectiveDefinitions().values();
    commonCheck(directiveDefinitions, errors);
}
Also used : Internal(graphql.Internal) Node(graphql.language.Node) INPUT_FIELD_DEFINITION(graphql.introspection.Introspection.DirectiveLocation.INPUT_FIELD_DEFINITION) DirectiveLocation(graphql.introspection.Introspection.DirectiveLocation) FIELD_DEFINITION(graphql.introspection.Introspection.DirectiveLocation.FIELD_DEFINITION) InputObjectTypeDefinition(graphql.language.InputObjectTypeDefinition) InputValueDefinition(graphql.language.InputValueDefinition) DirectiveDefinition(graphql.language.DirectiveDefinition) SchemaDefinition(graphql.language.SchemaDefinition) IllegalNameError(graphql.schema.idl.errors.IllegalNameError) ARGUMENT_DEFINITION(graphql.introspection.Introspection.DirectiveLocation.ARGUMENT_DEFINITION) UNION(graphql.introspection.Introspection.DirectiveLocation.UNION) ENUM(graphql.introspection.Introspection.DirectiveLocation.ENUM) EnumTypeDefinition(graphql.language.EnumTypeDefinition) DirectiveUnknownArgumentError(graphql.schema.idl.errors.DirectiveUnknownArgumentError) INPUT_OBJECT(graphql.introspection.Introspection.DirectiveLocation.INPUT_OBJECT) UnionTypeDefinition(graphql.language.UnionTypeDefinition) DirectiveMissingNonNullArgumentError(graphql.schema.idl.errors.DirectiveMissingNonNullArgumentError) EnumValueDefinition(graphql.language.EnumValueDefinition) DirectiveIllegalReferenceError(graphql.schema.idl.errors.DirectiveIllegalReferenceError) OBJECT(graphql.introspection.Introspection.DirectiveLocation.OBJECT) GraphQLError(graphql.GraphQLError) Map(java.util.Map) TypeName(graphql.language.TypeName) DirectiveUndeclaredError(graphql.schema.idl.errors.DirectiveUndeclaredError) FpKit.mergeFirst(graphql.util.FpKit.mergeFirst) ScalarTypeDefinition(graphql.language.ScalarTypeDefinition) SCALAR(graphql.introspection.Introspection.DirectiveLocation.SCALAR) INTERFACE(graphql.introspection.Introspection.DirectiveLocation.INTERFACE) NotAnInputTypeError(graphql.schema.idl.errors.NotAnInputTypeError) ObjectTypeDefinition(graphql.language.ObjectTypeDefinition) Collection(java.util.Collection) FieldDefinition(graphql.language.FieldDefinition) TypeDefinition(graphql.language.TypeDefinition) Collectors(java.util.stream.Collectors) Directive(graphql.language.Directive) Argument(graphql.language.Argument) MissingTypeError(graphql.schema.idl.errors.MissingTypeError) List(java.util.List) ENUM_VALUE(graphql.introspection.Introspection.DirectiveLocation.ENUM_VALUE) InterfaceTypeDefinition(graphql.language.InterfaceTypeDefinition) NamedNode(graphql.language.NamedNode) Optional(java.util.Optional) FpKit.getByName(graphql.util.FpKit.getByName) NonNullType(graphql.language.NonNullType) DirectiveIllegalLocationError(graphql.schema.idl.errors.DirectiveIllegalLocationError) InputObjectTypeDefinition(graphql.language.InputObjectTypeDefinition) ObjectTypeDefinition(graphql.language.ObjectTypeDefinition) SchemaDefinition(graphql.language.SchemaDefinition) EnumTypeDefinition(graphql.language.EnumTypeDefinition) InputObjectTypeDefinition(graphql.language.InputObjectTypeDefinition) InterfaceTypeDefinition(graphql.language.InterfaceTypeDefinition) UnionTypeDefinition(graphql.language.UnionTypeDefinition) DirectiveDefinition(graphql.language.DirectiveDefinition) Directive(graphql.language.Directive)

Aggregations

GraphQLError (graphql.GraphQLError)1 Internal (graphql.Internal)1 DirectiveLocation (graphql.introspection.Introspection.DirectiveLocation)1 ARGUMENT_DEFINITION (graphql.introspection.Introspection.DirectiveLocation.ARGUMENT_DEFINITION)1 ENUM (graphql.introspection.Introspection.DirectiveLocation.ENUM)1 ENUM_VALUE (graphql.introspection.Introspection.DirectiveLocation.ENUM_VALUE)1 FIELD_DEFINITION (graphql.introspection.Introspection.DirectiveLocation.FIELD_DEFINITION)1 INPUT_FIELD_DEFINITION (graphql.introspection.Introspection.DirectiveLocation.INPUT_FIELD_DEFINITION)1 INPUT_OBJECT (graphql.introspection.Introspection.DirectiveLocation.INPUT_OBJECT)1 INTERFACE (graphql.introspection.Introspection.DirectiveLocation.INTERFACE)1 OBJECT (graphql.introspection.Introspection.DirectiveLocation.OBJECT)1 SCALAR (graphql.introspection.Introspection.DirectiveLocation.SCALAR)1 UNION (graphql.introspection.Introspection.DirectiveLocation.UNION)1 Argument (graphql.language.Argument)1 Directive (graphql.language.Directive)1 DirectiveDefinition (graphql.language.DirectiveDefinition)1 EnumTypeDefinition (graphql.language.EnumTypeDefinition)1 EnumValueDefinition (graphql.language.EnumValueDefinition)1 FieldDefinition (graphql.language.FieldDefinition)1 InputObjectTypeDefinition (graphql.language.InputObjectTypeDefinition)1