dotansimha / dotansimha/graphql-code-generator

Ability to build composite generators with InputContext instead of Schema

Open
#2,152 4 comments 0 reactions 0 assignees View on GitHub
core
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

I'm working on a project where we hoping to create and reuse a couple of the graphql-code-generator plugins. The problem we have is simply the performance of aggregate generators. When each generator will be doing traversing thru the same graph that can be very very complex.

We found out that performance for large schemas we want to support will be degraded significantly and we hoping to contribute back to graphql-code-generator to see if we can support generation workflows.

## Generation workflows idea

Visitors for each particular plugin are expensive. Moving visitor outside brings serious performance and architectural benefits but overall it defeats the purpose of the graphql-code-generator. After we put visitors outside the plugins we can leverage generated objects better without the abstraction of the plugin by applying some templates and piping things into the file.

Instead of building those workflows in GraphBack we hoping to figure out how to do it in graphql-code-generator and contribute back plugins to community.

## Example Modern App Dev workflow

Example workflow we want to build using new plugins we going to create and reusing existing ones.

For server:
- Write GraphQL SDL types
- Use visitor can process sample schema
- Generate fully featured schema
- Generate Backend Types
- Generate Backend Resolvers
- Generate Backend Resolvers implementation
- Generate backend database access
- Generate Custom directives based on the users preference
- Generate Schema extensions based on GraphQL modules schemas.
- Generate Subscriptions

For client:
- Generate Client Side Types
- Generate Sample Client Side queries
- Generate Sample UI using React Forms builder.

All of those can rely on a single InputObject
This way we can put functional backend and frontend

## Things that limits this

Every plugin requires a schema to be passed
Every plugin somehow works in encapsulation
If visitor and code generation is the internal part of the plugin what will be the value of the GraphQL code generator (from the custom plugin developer point of view not an plugin/user point of view)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.