Flatten fragments in apollo client:codegen

Hello,

I’m using apollo client:codegen to generate a list of all the operations of my apps (so they can be synchronized as persisted queries).
I’m using this command line:

apollo client:codegen --localSchemaFile=graphql-schema.json --target=json --includes=src/**/*.ts* --tagName=gql __generated__/operations.json --globalTypesFile=src/__generated__/globalTypes.ts --passthroughCustomScalars

We are using collocated fragments extensively and the queries can end up including dozens of fragments that actually represent more or less the same fields. This means we end up with a huge query that hard to parse server side and that could be compacted.
I don’t see an option to compact/flatten the queries generated by client:codegen. Am I missing something? Do you think it would be something that could make sense?

1 Like

This functionality unfortunately does not exist in the apollo CLI tool. I agree it would be very nice to have.

1 Like