aws / aws/aws-appsync-community

[Feature Request] Detailed error messages for input types

Open
#322 0 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Hi!

This is a feature request for returning the field name when there is some syntax error in a mutation.

**Current Behaviour**

Given we have the following schema
```
mutation updateAddress
- input UpdateAddressInput

type Address
- name string!
- country string!
- ...

input UpdateAddressInput
- name string!
- country string!
- ...
```

When we execute the mutation
And we do not pass the required field `country`
Then this generic error is returned
`Variable 'input' has coerced Null value for NonNull type 'String!'`

**Desired Behaviour**
It would be nice if the error had a little bit more information, as types can become quite large, and potentially nested.

When we execute the mutation
And we do not pass the required field `country`
Then a more descriptive error is returned to the caller
e.g `Variable 'input' has coerced Null value for NonNull type $.input.country: 'String!'`

**Intention**
Make the UI developers job easier :)

Contributor guide

Open the contributing guide

Research direction

Start by investigating AWS AppSync's GraphQL mutation input coercion and error handling; the issue provides a schema and a missing country field as the reproduction. Done means errors for missing nested required fields identify the input path, such as $.input.country, while retaining the relevant type information.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.