Remove "path" from validation errors
Error "path" has been defined in the GraphQL spec for a while now and it should refer to a "response position".
A response position is a uniquely identifiable position in the response data produced during execution. It is either a direct entry in the resultMap of a ExecuteSelectionSet(), or it is a position in a (potentially nested) List value. Each response position is uniquely identifiable via a response path.
A response path uniquely identifies a response position via a list of path segments (response names or list indices) starting at the root of the response and ending with the associated response position.
https://spec.graphql.org/September2025/#sel-EAPHLDFAADHE0EwlG
If an error can be associated to a particular field in the GraphQL result, it must contain an entry with the key "path" with a response path which describes the response position which raised the error. This allows clients to identify whether a null resolved result is a true value or the result of an execution error.
https://spec.graphql.org/September2025/#sel-GAPHPHLCAACIH58S
However, GraphQL-Ruby has been putting "path"s in validation errors forever. (Including invalid ones: #4711.)
I think by the spec, "path" should be blank for those errors. And as mentioned in #4711, having a path that points to an unexpected/nonsensical location makes some integrations get messed up.
I propose:
- Removing "path" from validation errors by default
- Adding an opt-in config to put legacy paths in there for while
- Eventually removing that config
Any objections, blockers, comments, etc? cc @utay
LGTM!