apollographql / apollographql/apollo-tooling

Apollo Client Codegen does not take into account Field Policies (Apollo Client 3.0)

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

Description

**Intended outcome:**

Types generated by apollo client:codegen should take into account transformations resulting from [Field Policies](https://www.apollographql.com/docs/react/caching/cache-field-behavior/#the-read-function)

**Actual outcome:**

Types generated by apollo client:codegen do not reflect transformations resulting from Field Policies.

**How to reproduce the issue:**

Create a 'read' Field Policy that changes the type of a given cached field. The codegen type will not reflect this.

**Versions**

Tooling: 2.30.1
Apollo Client: 3.0.0

Contributor guide

Open the contributing guide

Research direction

Start at the apollo client:codegen entry point and review how generated types are derived from cached fields. Reproduce the issue with a Field Policy whose read function changes a field type, then verify that the generated type reflects that transformation.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.