Urql Introspection for Schema Awareness
Introspection plugin for urql. Generates a JSON file with the GraphQL schema. This file can be used to create a schema-aware cache.
- Version
- 5.0.0
- Weekly downloads
- 65k
- License
- MIT
- Updated
- Nov 11, 2026
Installation
npm i -D @graphql-codegen/urql-introspection
yarn add -D @graphql-codegen/urql-introspection
pnpm add -D @graphql-codegen/urql-introspection
bun add -D @graphql-codegen/urql-introspection
Config API Reference
module
type: string
Compatible only with JSON extension, allow you to choose the export type, either module.exports or export default. Allowed values are: commonjs, es2015.
Default value: “es2015”
Usage Examples
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'https://localhost:4000/graphql',
documents: ['src/**\/*.tsx'],
generates: {
'path/to/file.json': {
plugins: ['urql-introspection'],
config: {
module: 'commonjs'
},
},
},
};
export default config;
useTypeImports
type: boolean
Will use import type {} rather than import {} when importing only types. This gives
compatibility with TypeScript’s “importsNotUsedAsValues”: “error” option
Default value: “false”
Usage Examples
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'https://localhost:4000/graphql',
documents: ['src/**\/*.tsx'],
generates: {
'path/to/file.json': {
plugins: ['urql-introspection'],
config: {
useTypeImports: true
},
},
},
};
export default config;
includeScalars
type: boolean
Includes scalar names (instead of an Any replacement) in the output when enabled.
Default value: “false”
Usage Examples
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'https://localhost:4000/graphql',
documents: ['src/**\/*.tsx'],
generates: {
'path/to/file.json': {
plugins: ['urql-introspection'],
config: {
includeScalars: true
},
},
},
};
export default config;
includeEnums
type: boolean
Includes enums (instead of an Any replacement) in the output when enabled.
Default value: “false”
Usage Examples
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'https://localhost:4000/graphql',
documents: ['src/**\/*.tsx'],
generates: {
'path/to/file.json': {
plugins: ['urql-introspection'],
config: {
includeEnums: true
},
},
},
};
export default config;
includeInputs
type: boolean
Includes all input objects (instead of an Any replacement) in the output when enabled.
Default value: “false”
Usage Examples
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'https://localhost:4000/graphql',
documents: ['src/**\/*.tsx'],
generates: {
'path/to/file.json': {
plugins: ['urql-introspection'],
config: {
includeInputs: true
},
},
},
};
export default config;
includeDirectives
type: boolean
Includes all directives in the output when enabled. Default value: “false”
Usage Examples
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'https://localhost:4000/graphql',
documents: ['src/**\/*.tsx'],
generates: {
'path/to/file.json': {
plugins: ['urql-introspection'],
config: {
includeDirectives: true
},
},
},
};
export default config;