graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

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

Open robross0606 opened this issue 2 months ago • 1 comments

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:

"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

robross0606 avatar Oct 16 '25 15:10 robross0606

There is a field includeDeprecated on the introspection schema that determines whether deprecated fields will appear in introspection queries. Since it defaults to false, deprecated fields won't appear in introspection queries by default.

robross0606 avatar Oct 27 '25 16:10 robross0606