Search in sources :

Example 1 with FieldsConflict

use of graphql.validation.ValidationErrorType.FieldsConflict in project graphql-java by graphql-java.

the class OverlappingFieldsCanBeMerged method leaveSelectionSet.

@Override
public void leaveSelectionSet(SelectionSet selectionSet) {
    Map<String, List<FieldAndType>> fieldMap = new LinkedHashMap<>();
    Set<String> visitedFragmentSpreads = new LinkedHashSet<>();
    collectFields(fieldMap, selectionSet, getValidationContext().getOutputType(), visitedFragmentSpreads);
    List<Conflict> conflicts = findConflicts(fieldMap);
    for (Conflict conflict : conflicts) {
        addError(FieldsConflict, conflict.fields, conflict.reason);
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) FieldsConflict(graphql.validation.ValidationErrorType.FieldsConflict) ArrayList(java.util.ArrayList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

FieldsConflict (graphql.validation.ValidationErrorType.FieldsConflict)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1