Skip to content

Playground IntrospectionQuery without includeDeprecated for inputFields #2943

@lorf

Description

@lorf

Component(s)

router

Component version

0.321.2

wgc version

0.104.3

controlplane version

0.219.1

router version

0.321.2

What happened?

Description

The actual bug is in the playground page, I think.

Cosmo Playground page, provided by router, sometimes produces introspection queries, where inputFields field has no includeDeprecated: true argument. That leads to errors like the following for input types, that only has deprecated fields when playground page is first loaded in the browser or when "Re-fetch GraphQL Schema" button is pressed:

{
  "errors": [
    {
      "message": "Input Object type Inp must define one or more fields.",
      "extensions": {},
      "stack": "reportError@http://localhost:3002/:41:249101\nFy@http://localhost:3002/:41:253201\nxy/<@http://localhost:3002/:41:248808\nxy@http://localhost:3002/:41:248909\nZPe/b<@http://localhost:3002/:77:285405\nKs@http://localhost:3002/:41:64673\nu.useMemo@http://localhost:3002/:12:8009\nZPe@http://localhost:3002/:77:285381\nxs@http://localhost:3002/:41:60293\nFl@http://localhost:3002/:41:74358\nku@http://localhost:3002/:41:120284\nTc@http://localhost:3002/:41:108633\nEc@http://localhost:3002/:41:108561\nxc@http://localhost:3002/:41:108417\nlc@http://localhost:3002/:41:103575\nE@http://localhost:3002/:32:1375\nN@http://localhost:3002/:32:1906\n"
    }
  ]
}

Steps to Reproduce

  1. Start the router with the execution config provided below
    env EXECUTION_CONFIG_FILE_PATH=./exec.json ./router
  2. Open http://localhost:3002 in the browser
  3. Observe the error message in the response area:
    Image

Subgraph, that was used to produce execution config:

type Query {
  dummy: String
}

input Inp {
  fl: String @deprecated
}

Expected Result

No error is shown.

Actual Result

Error above is shown.

Environment information

Environment

OS: "Ubuntu 20.04"

Router configuration

# No explicit config

Router execution config

{"engineConfig":{"defaultFlushInterval":"500","datasourceConfigurations":[{"kind":"GRAPHQL","rootNodes":[{"typeName":"Query","fieldNames":["dummy"]}],"overrideFieldPathFromAlias":true,"customGraphql":{"fetch":{"url":{"staticVariableContent":"http://dummy"},"method":"POST","body":{},"baseUrl":{},"path":{}},"subscription":{"enabled":true,"url":{"staticVariableContent":"http://dummy"},"protocol":"GRAPHQL_SUBSCRIPTION_PROTOCOL_WS","websocketSubprotocol":"GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO"},"federation":{"enabled":true,"serviceSdl":"type Query {\n  dummy: String\n}\n\ninput Inp {\n  fl: String @deprecated\n}\n"},"upstreamSchema":{"key":"6e73a3201a142d46ad77bf180abbdd0b23dd6779"}},"requestTimeoutSeconds":"10","id":"0"}],"graphqlSchema":"schema {\n  query: Query\n}\n\ntype Query {\n  dummy: String\n}\n\ninput Inp {\n  fl: String @deprecated(reason: \"No longer supported\")\n}","stringStorage":{"6e73a3201a142d46ad77bf180abbdd0b23dd6779":"schema {\n  query: Query\n}\n\ninput Inp {\n  fl: String @deprecated(reason: \"No longer supported\")\n}\n\ntype Query {\n  dummy: String\n}"}},"version":"00000000-0000-0000-0000-000000000000","subgraphs":[{"id":"0","name":"sub","routingUrl":"http://dummy"}],"compatibilityVersion":"1:{{$COMPOSITION__VERSION}}"}

Log output

Additional context

There was #2030, but it looks like it's not enough. Maybe adding inputValueDeprecation: true to GraphiQL initialization will help?

diff --git a/playground/src/components/playground/index.tsx b/playground/src/components/playground/index.tsx
index 4bd48b672..ff9c610d0 100644
--- a/playground/src/components/playground/index.tsx
+++ b/playground/src/components/playground/index.tsx
@@ -723,6 +723,7 @@ export const Playground = (input: {
               }),
             ]}
             forcedTheme={input.theme}
+            inputValueDeprecation={true}
           />
           {isMounted && <PlaygroundPortal />}
         </TraceContext.Provider>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions