Kong / Kong/insomnia

GQL required fields with default values causes error tooltip in Query Variables pane

Open
#5,212 0 comments 0 reactions 0 assignees View on GitHub
A-graphql B-bug S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

GraphQL schema containing required fields with default values should not trigger red squiggly lines and a red error tooltip in the `Query Variables` editor

### Actual Behavior

GraphQL schema containing required fields with default values trigger red squiggly lines and a red outline error tooltip in the `Query Variables` editor

The text is `Object of type "" is missing required field ""`

### Reproduction Steps

With schema:

```
schema {
mutation: Mutation
}

type Mutation {
sendMutation(myInput: MyInput!) : Boolean!
}

input MyInput {
intField: Int!
boolFieldDefaultValue: Boolean! = false
}
```

GraphQL pane:

```
mutation ($myInput: MyInput!) {
sendMutation(myInput: $myInput) {
__typename
}
}
```

Variables pane:

```
{
"myInput": {
"intField": 1
}
}
```

### Is there an existing issue for this?

- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Additional Information

_No response_

### Insomnia Version

2022.5.1

### What operating system are you using?

Windows

### Operating System Version

Windows 11 Pro Version 21H2 22000.1042

### Installation method

download from insomnia.rest

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the validation error in the Query Variables editor using the schema and mutation shown in the issue. Trace how required GraphQL input fields with default values are validated, then verify that the red squiggles and tooltip no longer appear and add a regression test for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.