Search in sources :

Example 1 with InterfaceFieldArgumentRedefinitionError

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

the class SchemaTypeChecker method checkArgumentConsistency.

private void checkArgumentConsistency(String typeOfType, ObjectTypeDefinition objectTypeDef, InterfaceTypeDefinition interfaceTypeDef, FieldDefinition objectFieldDef, FieldDefinition interfaceFieldDef, List<GraphQLError> errors) {
    List<InputValueDefinition> objectArgs = objectFieldDef.getInputValueDefinitions();
    List<InputValueDefinition> interfaceArgs = interfaceFieldDef.getInputValueDefinitions();
    for (int i = 0; i < interfaceArgs.size(); i++) {
        InputValueDefinition interfaceArg = interfaceArgs.get(i);
        InputValueDefinition objectArg = objectArgs.get(i);
        String interfaceArgStr = AstPrinter.printAst(interfaceArg);
        String objectArgStr = AstPrinter.printAst(objectArg);
        if (!interfaceArgStr.equals(objectArgStr)) {
            errors.add(new InterfaceFieldArgumentRedefinitionError(typeOfType, objectTypeDef, interfaceTypeDef, objectFieldDef, objectArgStr, interfaceArgStr));
        }
    }
}
Also used : InterfaceFieldArgumentRedefinitionError(graphql.schema.idl.errors.InterfaceFieldArgumentRedefinitionError) InputValueDefinition(graphql.language.InputValueDefinition)

Aggregations

InputValueDefinition (graphql.language.InputValueDefinition)1 InterfaceFieldArgumentRedefinitionError (graphql.schema.idl.errors.InterfaceFieldArgumentRedefinitionError)1