graphql-codegen-sqlmancer v0.1.0
Sqlmancer
Conjure SQL from your GraphQL queries 🧙🔮✨
This is a Graphql Code Generator plugin for generating types for Sqlmancer.
Installation
npm install --save-dev @graphql-codegen/cli typescript-sqlmancerUsage
Add a codegen.yml configuration file and point it to your type definitions:
schema: src/**/*.graphql
generates:
path/to/file.ts:
plugins:
- graphql-codegen-sqlmancerThen run the CLI command:
npx graphql-codegenConfiguration
The plugin generates both a SqlmancerClient type to be used with Sqlmancer, as well as type definitions to be used in your resolvers. This plugin uses the @graphql-codegen/typescript and @graphql-codegen/typescript-resolvers under the hood to generate the resolver types. You can skip generating these types by setting withResolvers to false.
schema: src/**/*.graphql
generates:
path/to/file.ts:
plugins:
- graphql-codegen-sqlmancer
config:
withResolvers: falseNOTE: The plugin will compile your schema, including all transformations applied by Sqlmancer directives, before passing it to the
typescriptandtypescript-resolversplugins. These other plugins should not be used in addition to the Sqlmancer plugin -- doing so may result in the generator output not reflecting the final schema.
6 years ago