Search in sources :

Example 1 with TypeExtensionFieldRedefinitionError

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

the class SchemaTypeExtensionsChecker method checkForInputValueRedefinition.

private void checkForInputValueRedefinition(List<GraphQLError> errors, InputObjectTypeExtensionDefinition typeDefinition, List<InputValueDefinition> inputValueDefinitions, List<InputValueDefinition> referenceInputValues) {
    Map<String, InputValueDefinition> referenceMap = FpKit.getByName(referenceInputValues, InputValueDefinition::getName, mergeFirst());
    inputValueDefinitions.forEach(fld -> {
        InputValueDefinition reference = referenceMap.get(fld.getName());
        if (referenceMap.containsKey(fld.getName())) {
            // ok they have the same field but is it the same type
            if (!isSameType(fld.getType(), reference.getType())) {
                errors.add(new TypeExtensionFieldRedefinitionError(typeDefinition, fld));
            }
        }
    });
}
Also used : TypeExtensionFieldRedefinitionError(graphql.schema.idl.errors.TypeExtensionFieldRedefinitionError) InputValueDefinition(graphql.language.InputValueDefinition)

Example 2 with TypeExtensionFieldRedefinitionError

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

the class SchemaTypeExtensionsChecker method checkForFieldRedefinition.

private void checkForFieldRedefinition(List<GraphQLError> errors, TypeDefinition typeDefinition, List<FieldDefinition> fieldDefinitions, List<FieldDefinition> referenceFieldDefinitions) {
    Map<String, FieldDefinition> referenceMap = FpKit.getByName(referenceFieldDefinitions, FieldDefinition::getName, mergeFirst());
    fieldDefinitions.forEach(fld -> {
        FieldDefinition reference = referenceMap.get(fld.getName());
        if (referenceMap.containsKey(fld.getName())) {
            // ok they have the same field but is it the same type
            if (!isSameType(fld.getType(), reference.getType())) {
                errors.add(new TypeExtensionFieldRedefinitionError(typeDefinition, fld));
            }
        }
    });
}
Also used : TypeExtensionFieldRedefinitionError(graphql.schema.idl.errors.TypeExtensionFieldRedefinitionError) FieldDefinition(graphql.language.FieldDefinition)

Aggregations

TypeExtensionFieldRedefinitionError (graphql.schema.idl.errors.TypeExtensionFieldRedefinitionError)2 FieldDefinition (graphql.language.FieldDefinition)1 InputValueDefinition (graphql.language.InputValueDefinition)1