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

Validation errors should include a path #102

Open
rgraff opened this issue Nov 27, 2023 · 0 comments
Open

Validation errors should include a path #102

rgraff opened this issue Nov 27, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rgraff
Copy link

rgraff commented Nov 27, 2023

Is your feature request related to a problem? Please describe.

Validation errors include a fields list that is snakecase, but should instead include a path that is camelCase.

Given a mutation like this:

mutation {
  addOverride(input: {  override: { variantKey: $variantKey}}) { ... }
}

if your variantKey is invalid (InvalidArgument), you'll get a response like this:

%{"data" => %{"addOverride" => %{"errors" => [%{"code" => "invalid_argument", "fields" => ["variant_key"], "message" => "variant key not found"}], "result" => nil}}}

Describe the solution you'd like

You'll want a response like this with path and camelCase

%{"data" => %{"addOverride" => %{"errors" => [%{"code" => "invalid_argument", "path" => ["input", "override", "variantKey"], "message" => "variant key not found"}], "result" => nil}}}

Additional context
I'm unfamiliar with the graphql spec and conventions, there may be a standard here that I'm unaware of.

@rgraff rgraff added the enhancement New feature or request label Nov 27, 2023
@zachdaniel zachdaniel added the good first issue Good for newcomers label Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants