apollographql / apollographql/apollo-tooling

Code generation templates support

Open
#877 0 comments 2 reactions 0 assignees View on GitHub
🤖 component - codegen
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

Code generation is not flexible now.
1. Only concrete languages (Swift, TypeScript, Flow) can be specified.
2. The structure of the generated code cannot be changed.
3. New language support requires changes directly in the code.

So I propose to introduce templates support.

Great example of code generation is [SwiftGen](https://github.com/SwiftGen/SwiftGen). It uses a template language syntax similar to Django and Mustache. It has default templates and allows creating custom templates.

There's js library [mustache.js](https://github.com/janl/mustache.js/) that provides templates support.

My proposal is to migrate code generation into _mustache.js-like_ templates for all supported languages.

Contributor guide

Open the contributing guide

Research direction

No implementation files or tests are named. Start by locating the existing TypeScript code-generation entry points and reviewing how Swift, TypeScript, and Flow output is produced; done means generation supports customizable templates and new language support without direct generator-code changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.