dotansimha / dotansimha/graphql-code-generator
make convertFactory more reusable
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
It would be nice to reuse the NamingConvention parameter across generators. Currently, the visitor-plugin-common/src/naming defines a convertFactory that can only apply different naming functions (enum or types) if the input is an AST node. If the convertFactory were to return a data structure with a converter for each possible naming scenario e.g. an object `{ types: ...some func..., enum: ...some func...}` or perhaps if the ConvertOptions could take a "assume this AST node type even though the input is not an AST node" then the returned function could be more generally applied in places where you do not have the AST node handy. The current plugin codebase partially assumes an immediate render mode but other plugins create an intermediate representation and then render only in the last step where the AST is no longer available.
P.S. I favor adding a value to ConvertOptions that takes the "kind" of conversion to perform.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.