Skip to content

broken introspection, frontend types generators not work #2698

@flymedllva

Description

@flymedllva

Component(s)

router

Component version

router@0.296.0

wgc version

wgc@0.112.4

controlplane version

router version

router@0.296.0

What happened?

in one of the cosmo releases broke introspection for fields marked @deprecated. In general, introspection is sometimes delusional.

Description

we use graphql-codegen to collect schematics from the router, but when we try to upgrade to the latest versions of the router, the fields marked @deprecated disappear and the playground breaks.

graphql-codegen sends queries like this

query IntrospectionQuery($a: Boolean = true){__schema {queryType {name} mutationType {name} subscriptionType {name} types {kind name description fields(includeDeprecated: $a){name description args {name description type {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name}}}}}}}}}} defaultValue} type {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name}}}}}}}}}} isDeprecated deprecationReason} inputFields {name description type {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name}}}}}}}}}} defaultValue} interfaces {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name}}}}}}}}}} enumValues(includeDeprecated: $a){name description isDeprecated deprecationReason} possibleTypes {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name}}}}}}}}}}} directives {name description locations args {name description type {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name ofType {kind name}}}}}}}}}} defaultValue}}}}

the feeling that includeDeprecated in query is broken

Steps to Reproduce

https://github.com/flymedllva/cosmo-introspection-broken

Expected Result

To make things work as before, deprecated fields were included in introspection, and cli utilities for graphql (including those not yours, such as graphql-codegen) worked.
In general, I would like the router's introspection to be fixed, since you still have to use Apollo for it – #991 The problem still persists, the error has disappeared, but introspection gives out nonsense.

Actual Result

if at least one field is marked @deprecated, an error will occur.
if all fields of type/input are marked as @deprecated, then this type/input is removed from introspection.
The feeling that includeDeprecated in introspection is not working as expected
Playground is broken
Using introspection is useless now because it gives out nonsense

{
  "errors": [
    {
      "message": "Input Object type TestAllFieldsDeprecatedFilterInput must define one or more fields.",
      "extensions": {},
      "stack": "GraphQLError: Input Object type TestAllFieldsDeprecatedFilterInput must define one or more fields.\n    at Ey.reportError (http://localhost:3002/:41:249079)\n    at _y (http://localhost:3002/:41:253179)\n    at http://localhost:3002/:41:248786\n    at Object.xy (http://localhost:3002/:41:248887)\n    at http://localhost:3002/:69:285337\n    at Object.Ks [as useMemo] (http://localhost:3002/:41:64671)\n    at u.useMemo (http://localhost:3002/:12:8009)\n    at SchemaContextProvider (http://localhost:3002/:69:285313)\n    at xs (http://localhost:3002/:41:60291)\n    at _l (http://localhost:3002/:41:74356)"
    }
  ]
}
Image

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Package Manager: pnpm, npm, yarn, etc
Compiler(if manually compiled): (e.g., "go 14.2")

Router configuration

Router execution config

Log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions