apollographql / apollographql/apollo-tooling
apollo client:codegen Add custom header to output
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
With `--passthroughCustomScalars`, the TypeScript codegen will generate files with unknown types for custom scalars, resulting in output that does not compile.
To get my definition of those scalars into the codegen output, I am using `--customScalarsPrefix=CustomScalars.` and then using a shell script to add the following code at the top of the codegen output:
```
import * as CustomScalars from './CustomScalars'
```
To avoid this postprocessing step, can we add an option to prepend arbitrary content to the codegen output?
Contributor guide
Research direction
Locate the TypeScript codegen entry point handling --passthroughCustomScalars and --customScalarsPrefix, then trace where generated output is assembled. Confirm that configurable content can be emitted before the generated code and that the resulting output compiles without shell postprocessing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100