public ExecutionPath getPathWithoutListEnd() { if (ROOT_PATH.equals(this)) { return ROOT_PATH; } if (segment instanceof StringPathSegment) { return this; } return parent; }
/** * @return the path as a string which represents the call hierarchy */ @Override public String toString() { if (parent == null) { return ""; } if (ROOT_PATH.equals(parent)) { return segment.toString(); } return parent.toString() + segment.toString(); }
/** * This method will only put one error per field path. * * @param error the error to add * @param fieldPath the field path to put it under */ public void addError(GraphQLError error, ExecutionPath fieldPath) { // // see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability about how per // field errors should be handled - ie only once per field if its already there for nullability // but unclear if its not that error path // for (GraphQLError graphQLError : errors) { List<Object> path = graphQLError.getPath(); if (path != null) { if (fieldPath.equals(ExecutionPath.fromList(path))) { return; } } } this.errors.add(error); }
public ExecutionPath sibling(String siblingField) { Assert.assertTrue(!ROOT_PATH.equals(this), "You MUST not call this with the root path"); return new ExecutionPath(this.parent, new StringPathSegment(siblingField)); }
public ExecutionPath getPathWithoutListEnd() { if (ROOT_PATH.equals(this)) { return ROOT_PATH; } if (segment instanceof StringPathSegment) { return this; } return parent; }
/** * @return the path as a string which represents the call hierarchy */ @Override public String toString() { if (parent == null) { return ""; } if (ROOT_PATH.equals(parent)) { return segment.toString(); } return parent.toString() + segment.toString(); }
/** * This method will only put one error per field path. * * @param error the error to add * @param fieldPath the field path to put it under */ public void addError(GraphQLError error, ExecutionPath fieldPath) { // // see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability about how per // field errors should be handled - ie only once per field if its already there for nullability // but unclear if its not that error path // for (GraphQLError graphQLError : errors) { List<Object> path = graphQLError.getPath(); if (path != null) { if (fieldPath.equals(ExecutionPath.fromList(path))) { return; } } } this.errors.add(error); }
public ExecutionPath sibling(String siblingField) { Assert.assertTrue(!ROOT_PATH.equals(this), "You MUST not call this with the root path"); return new ExecutionPath(this.parent, new StringPathSegment(siblingField)); }