graphql / graphql/graphiql

[graphiql] Input Object type ... must define one or more fields.

Open
#4,115 1 comment 0 reactions 0 assignees View on GitHub
bug graphiql
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Current Behavior

If an input type has only one field in it that is deprecated, GraphiQL throws an error. For example, with this schema:

```graphql
"Input type used to update an existing Study Activity Item."
input StudyActivityItemDetailUpdateInput {
"The preferred display name for this item."
displayName: String @deprecated(reason: "Use `updateScheduledActivity()` with `ScheduledActivityUpdateInput.displayName` instead.")
}
```

GraphiQL throws errors in multiple places and becomes unusable for documentation:

Image

It is still possible to successfully run queries. It seems like GraphiQL is maybe filtering out deprecated fields and then validating the schema without them. Insomnia and other tools have no such problem.

### Expected Behavior

GraphiQL should now show and error about validation since this field still exists, but is deprecated.

### Steps To Reproduce

1. Create an input type with one one field in it.
2. Mark that field as `@deprecated`.
3. Load the schema in GraphiQL.

### Environment

* GraphiQL Version: Unknown since I cannot find that information in the minified CDN bundle or in the UI.
* OS: Any
* Browser: Chrome
* Bundler: CDN
* `react` Version: None
* `graphql` Version: 15

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.