Code Generation

Control the code generation process to better meet your needs.

Introspection

GraphQL Schema Introspection enables you to query a GraphQL server for information about it's underlying schema. This includes data such as types, fields, queries, mutations, and even the field-level descriptions.

Local Schema

A local schema file can be used to generate types for your GraphQL operations.

This is useful when you want to generate types for a GraphQL API that is not publicly available.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-graphql-client'],

  runtimeConfig: {
    public: {
      'graphql-client': {
        clients: {
          default: {
            schema: '<relative_path_to_schema_file>',
          }
        }
      }
    }
  }
})

Disable Codegen

To disable code generation, set codegen to false in your nuxt.config.ts file.

export default defineNuxtConfig({
  modules: ['nuxt-graphql-client'],

  'graphql-client': {
    codegen: false
  }
})