apollographql / apollographql/apollo-tooling

apollo client:codegen --namespace is not working for TypeScript

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

Description

**Intended outcome:**
The generated type definition should be wrapped in the given namespace.

**Actual outcome:**
The generated file is not wrapped in the namespace.

**How to reproduce the issue:**

apollo client:codegen `--namespace=MyGQL` --addTypename --passthroughCustomScalars --customScalarsPrefix Scalar --outputFlat --target=typescript ./graphql/types.ts

All of the definition is not wrapped in `MyGQL` namespace.

**Versions**

apollo/2.8.3 linux-x64 node-v10.15.3

Contributor guide

Open the contributing guide

Research direction

Start at the `apollo client:codegen` TypeScript code-generation entry point and reproduce the issue with the command shown, using `./graphql/types.ts` as the output. Done means the generated definitions are wrapped in the requested `MyGQL` namespace while preserving the other command options.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.