apollographql / apollographql/apollo-tooling

apollo client:codegen behaves differently when using endpoint VS when using key+variant

Open
#2,448 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Intended outcome:**

I am trying to generate types using two different commands:

```
yarn apollo client:codegen . --target=typescript --passthroughCustomScalars --includes=packages/**/*.gql --endpoint=https://***
```

```
yarn apollo client:codegen . --target=typescript --passthroughCustomScalars --includes=packages/**/*.gql --key=*** variant=current
```

I would expect the generated types to be the same, since both are pointing to the same schema.

**Actual outcome:**

The actual outcome is not as expected: the types are the same, but the order of the tuples and interface keys are not the same.

Using the first command, the keys are sorted alphabetically.
Using the second command, it is not the case (the order is consistent for each run, but I don't know what the logic behind it is).

**How to reproduce the issue:**

Run the commands on your favorite schema (using Apollo Studio to retrieve the key and variant).

**Versions**

"apollo": "2.33.6"

Contributor guide

Open the contributing guide

Research direction

The issue names no source files or tests; start by running both `apollo client:codegen` commands from the reproduction steps against the same schema and compare the generated tuple and interface ordering. Done means endpoint and key+variant generation produce identical output ordering for the reported Apollo 2.33.6 case.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
cli, 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.