Search in sources :

Example 1 with TypeExtensionMissingBaseTypeError

use of graphql.schema.idl.errors.TypeExtensionMissingBaseTypeError in project graphql-java by graphql-java.

the class SchemaTypeExtensionsChecker method checkTypeExtensionHasCorrespondingType.

private void checkTypeExtensionHasCorrespondingType(List<GraphQLError> errors, TypeDefinitionRegistry typeRegistry, String name, List<? extends TypeDefinition> extTypeList, Class<? extends TypeDefinition> targetClass) {
    TypeDefinition extensionDefinition = extTypeList.get(0);
    Optional<? extends TypeDefinition> typeDefinition = typeRegistry.getType(new TypeName(name), targetClass);
    if (!typeDefinition.isPresent()) {
        errors.add(new TypeExtensionMissingBaseTypeError(extensionDefinition));
    }
}
Also used : TypeName(graphql.language.TypeName) TypeExtensionMissingBaseTypeError(graphql.schema.idl.errors.TypeExtensionMissingBaseTypeError) InputObjectTypeDefinition(graphql.language.InputObjectTypeDefinition) EnumTypeDefinition(graphql.language.EnumTypeDefinition) UnionTypeDefinition(graphql.language.UnionTypeDefinition) ScalarTypeDefinition(graphql.language.ScalarTypeDefinition) ObjectTypeDefinition(graphql.language.ObjectTypeDefinition) TypeDefinition(graphql.language.TypeDefinition) InterfaceTypeDefinition(graphql.language.InterfaceTypeDefinition)

Aggregations

EnumTypeDefinition (graphql.language.EnumTypeDefinition)1 InputObjectTypeDefinition (graphql.language.InputObjectTypeDefinition)1 InterfaceTypeDefinition (graphql.language.InterfaceTypeDefinition)1 ObjectTypeDefinition (graphql.language.ObjectTypeDefinition)1 ScalarTypeDefinition (graphql.language.ScalarTypeDefinition)1 TypeDefinition (graphql.language.TypeDefinition)1 TypeName (graphql.language.TypeName)1 UnionTypeDefinition (graphql.language.UnionTypeDefinition)1 TypeExtensionMissingBaseTypeError (graphql.schema.idl.errors.TypeExtensionMissingBaseTypeError)1