Types are not generated for introspection query
See original GitHub issueDescribe 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
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:28 (14 by maintainers)
Top Results From Across the Web
Introspection query without generated types - Discuss Dgraph
I'm trying to use a tool to visualize my GraphQL schema. The problem is that it comes with too much garbage. I wanted...
Read more >Why You Should Disable GraphQL Introspection In Production
GraphQL introspection enables you to query a GraphQL server for information about the underlying schema. This includes data like types, ...
Read more >Introspection - GraphQL
We designed the type system, so we know what types are available, but if we didn't, we can ask GraphQL, by querying the...
Read more >How to generate typescript from graphQL typeDefs, not by ...
I have many files with type definitions of different queries, like this: const typeDefs = gql` type Query { hello: String } `...
Read more >Introspection - Hot Chocolate - ChilliCream GraphQL Platform
Every GraphQL server exposes a __schema and __type field on the query type as well as an __typename field on each type.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Jonatthu Well, ask the Microsoft, they have deprecated namespaces from TypeScript. For the same reason, they are not supported by Babel TypeScript implementation, so it’s a kinda wrong path to follow altogether.
Fixed in 0.18.0 🎉