Skip to main content

Urql Introspection for Schema Awareness

This plugin generates an introspection file for Schema Awareness feature of Urql Cache Exchange

You can read more about it in urql documentation: https://formidable.com/open-source/urql/docs/graphcache/schema-awareness/.

Urql Introspection plugin accepts a TypeScript / JavaScript or a JSON file as an output (.ts, .tsx, .js, .jsx, .json).

Both in TypeScript and JavaScript a default export is being used.

The output is based on the output you choose for the output file name.

Installation

urql-introspection plugin version
Using yarn
yarn add -D @graphql-codegen/urql-introspection

API Reference

module

type: string (values: commonjs, es2015) default: es2015

Compatible only with JSON extension, allow you to choose the export type, either module.exports or export default. Allowed values are: commonjs, es2015.

Usage Examples

generates:
path/to/file.json:
plugins:
- urql-introspection
config:
module: commonjs

How to use?#

// generated by the plugin
import schema from './generated-introspection.json';
const cache = cacheExchange({ schema });

Read more about Schema Awareness