Skip to content

Types are not generated for introspection query #643

@danielkcz

Description

@danielkcz

Describe the bug
I have a query like this which reads introspection in runtime to figure user permissions. Unfortunately, the generated types do not include the GUserPermissions type at all. But if I add something else to that query, it appears there, but without the introspection part.

export const UserPermissionsQuery = gql`
  query GUserPermissions {
    __schema {
      queryType { fields { name } }
      mutationType { fields { name } }
    }
  }
`

To Reproduce
I am using API approach and call it like this. Full introspection is generated in JSON file. I've checked and it includes types for __schema, so that should be a problem.

  generate({
    schema: jsonPath,
    out: './src/graph/types.ts',
    template: 'graphql-codegen-typescript-template',
    args: ['./src/**/*graphql.ts'],
    skipSchema: true,
    overwrite: true,
  })

Expected behavior
To have TypeScript types based on introspection query.

Environment:

  • OS: Windows 10 x64
  • Codegen: 0.9.2
  • Node: 10.11.0

Metadata

Metadata

Assignees

Labels

coreRelated to codegen core/clipluginswaiting-for-releaseFixed/resolved, and waiting for the next stable release

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions