dotansimha / dotansimha/graphql-code-generator

Feature Request: Option to disable processing type extensions

Open
#7,011 2 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

#### Problem

Currently GraphQL Codegen always combines type extensions into a single type definition when merging schemas. In some cases, it would be useful to preserve separate type extension definitions in the final output.

One such case is using the `schema-ast` plugin to output a schema for use with Apollo Federation. In Apollo Federation there is a clear distinction between a schema that includes a type definition for a given object type and a schema that only includes type extensions for an object type (see [defining an entity](https://www.apollographql.com/docs/federation/entities/#defining) vs [extending an entity](https://www.apollographql.com/docs/federation/entities/#extending)). In this case, I would want the extensions to remain and not be combined/converted into a type definition.

#### Suggested solution
An additional option to preserve extensions would solve this use case.

#### Describe alternatives you've considered
Whether to combine extensions could also be influenced by the existing `federation` setting, although I think it would be harder to understand whether or not type extensions will be combined and why. A separate option as suggested above would be more explicit.

My only workaround at the moment is to edit generated files to re-introduce the `extend type` on relevant type definitions.

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.