Skip to content

[graphiql] Nested input object fields do not open in Documentation Explorer #4441

Description

@pur3miish

Current Behavior

Cmd/Ctrl-clicking a field inside a GraphQL input object literal in the Monaco operation editor opens the Documentation Explorer, but the explorer does not navigate to the clicked input field.

For example, given a schema with nested input object types and this mutation:

mutation {
  submit(
    order: {
      lineItem: {
        quantity: 1
      }
    }
  )
}

Cmd/Ctrl-clicking lineItem or quantity leaves the Documentation Explorer at its previous location. Equivalent Cmd/Ctrl-click navigation for query selection fields works.

The Monaco definition provider already recognizes these tokens:

kind === 'ObjectField' && step === 0 && typeInfo.fieldDef

However, packages/graphiql-plugin-doc-explorer/src/schema-reference.ts only resolves Field and AliasedField field references. ObjectField is ignored. In addition, typeInfo.parentType still points to the enclosing output type, so the input object type that owns the clicked input field must be resolved from the schema.

Expected Behavior

Cmd/Ctrl-clicking a nested input object field should navigate the Documentation Explorer to that input field under its owning GraphQLInputObjectType, just as clicking a query selection field navigates to its field documentation.

Steps To Reproduce

  1. Render GraphiQL with the default Documentation Explorer and a schema containing a mutation argument whose type is a nested input object.
  2. Enter a mutation using nested input object literals.
  3. Cmd-click on macOS, or Ctrl-click on other platforms, an input object key.
  4. Observe that the Documentation Explorer becomes visible but does not navigate to the clicked field.
  5. Cmd/Ctrl-click a query selection field and observe that navigation works.

Environment

  • GraphiQL: 5.2.2 (also present on current main)
  • @graphiql/react: 0.37.3 / current main
  • @graphiql/plugin-doc-explorer: 0.4.1 / current main
  • OS: macOS
  • Browser: Chromium
  • React: 19
  • GraphQL: 16

Proposed Fix

Teach the Documentation Explorer's schema-reference resolver to handle ObjectField. For that reference kind, locate the GraphQLInputObjectType whose field map owns typeInfo.fieldDef, then create the same field reference shape used for ordinary fields.

A regression test should cover a nested mutation input and verify both the owning input type and clicked field are resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions