Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 8, 2021. It is now read-only.
/graphqlgenPublic archive

⚙️ Generate type-safe resolvers based upon your GraphQL Schema

License

NotificationsYou must be signed in to change notification settings

prisma-labs/graphqlgen

Repository files navigation

graphqlgen

CircleCInpm version

Generate & scaffold type-safe resolvers based on your GraphQL Schema in TypeScript, Flow & Reason

Deprecation note

graphqlgen has been officially deprecated in favor of theThe Guild's projectGraphQL Code Generator. Learn more about the collaboration of Prisma and the Guild inthis blog post.


About

Highlights

  • Schema-first Design in SDL to derive ideal types
  • Type-safety Resolvers with precise signatures includingparent,args and return type
  • DX Precise resolver types puts your editor intellisense to work
  • Ecosystem Interop codegen suitable for Yoga 1 or Apollo Server and supportsprettier andgraphql-import out of the box

Motivation

Programming in type-safe environments can contribute toward great confidence in your code's integrity.graphqlgen aims to leverage the GraphQL type system to make your resolvers completely type-safe. This is important because resolvers are the heart of any graphql service and yet the hardest to statically type due to their dynaminism.

Supported languages

  • TypeScript
  • Flow

Others under discussion:

Getting started

Try out a project initializer

  1. Run initializer

    yarn create graphqlgen my-app# npm init graphqlgen my-appcd my-appyarn start# npm run start
  2. Edit./my-app/src/schema.graphql to your heart's content.

  3. Generate types:

    yarn graphqlgen

Add to existing project

yarn add --dev graphqlgen# npm install --save-dev graphqlgen

Then you will have access to the cli (gg orgraphqlgen):

yarn -s gg --help# npm run gg --help
Usage: graphqlgen or ggOptions:  -i, --init     Initialize a graphqlgen.yml file  -v, --version  Show version number                                   [boolean]  -h, --help     Show help                                             [boolean]

gg depends on the presence of agraphqlgen.yml configlocated in the directory wheregg is invoked. Here is an example:

language:typescriptschema:./src/schema.graphqlcontext:./src/context.ts:Contextoutput:./src/generated/graphqlgen.tsmodels:files:    -./src/generated/prisma-client/index.ts

Documentation

https://oss.prisma.io/graphqlgen

Addendum

Community

Join us at#graphqlgen in ourSlack group and if you have more fleshed out ideas, bug reports etc. create a Github issue:

Project Status

graphqlgen is still in early stage development where breaking changes and tool design are a fluid matter. Feedback is deeply appreciated. You may feel comfortable giving it a try on production systems since there is no runtime aspect and hence quite safe to do so (save for a few optional default resolvers).

Prior Art

  • gqlgen is the Golang equivalent ofgraphqlgen and served as a source of inspiration
  • graphql-code-generator is a similar tool based on templates support both frontend & backend

Prisma

About

⚙️ Generate type-safe resolvers based upon your GraphQL Schema

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors33


[8]ページ先頭

©2009-2025 Movatter.jp