Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verbose validation errors to match graphql-js #874

Closed
smyrick opened this issue Jun 25, 2024 · 1 comment
Closed

Verbose validation errors to match graphql-js #874

smyrick opened this issue Jun 25, 2024 · 1 comment
Labels

Comments

@smyrick
Copy link
Member

smyrick commented Jun 25, 2024

Recreating the issue from the Router since this is where validation happens now: apollographql/router#2984

Description

Previously on the Gateway, operation validation errors would be verbose about the serialization issues, in particular with input and arguments.

For example here is the error message from Gateway on passing null to a Float! inside a nested param block

type Query {
  getData(params: MyInput)
}

input MyInput {
  coordinates: CoordinatesInput
  # ...many other input options
}

input CoordinatesInput {
  latitude: Float!
  longitude: Float!
}

Variable "$params" got invalid value null at "params.coordinates.latitude"; Expected non-nullable type "Float!" not to be null.

This is clear on what the error is and where is needs to be fixed.

In the Router all we get back is this:

invalid type for variable: 'params'

When the input arguments are large this can be much more problematic to debug and find where within params the error occurred

Possible Solutions

Router includes parsing/serialization error locations when parsing variables and input.

@smyrick smyrick added the triage label Jun 25, 2024
@goto-bus-stop
Copy link
Member

Since this is about variables, this actually should be addressed in the router. It's not a validation error but an execution error. The query is valid, but the JSON inputs in the HTTP request are not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants