apollographql / apollographql/apollo-tooling

apollo client:codegen --mergeInFieldsFromFragmentSpreads option does nothing

Open
#2,444 2 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

`mergeInFieldsFromFragmentSpreads` is on by default. The command line option allows you to only turn it on. There is no way turn it off.

`mergeInFieldsFromFragmentSpreads` is implemented as an oclif boolean flag so alternatives like `apollo client:codegen --mergeInFieldsFromFragmentSpreads=false` don't work.

There is an older issue: https://github.com/apollographql/apollo-tooling/issues/537 where the meaning of the flag was inverted but this was not done everywhere.

Potentially the fix is as simple as changing this line: https://github.com/apollographql/apollo-tooling/blob/master/packages/apollo/src/commands/client/codegen.ts#L235
From `flags.mergeInFieldsFromFragmentSpreads` to `!!flags.mergeInFieldsFromFragmentSpreads`

It might also be necessary to update the docs.

Contributor guide

Open the contributing guide

Research direction

Start in packages/apollo/src/commands/client/codegen.ts around line 235 and inspect the oclif flag definition and how its value is passed to code generation. Check the client codegen documentation for the option, then run the command with the option enabled and disabled to confirm that both states are respected and the documented behavior matches.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.