hasura / hasura/graphql-engine

__typename field for arr_rel_insert_input & insert_input

Open
#4,379 1 comment 5 reactions 0 assignees View on GitHub
support/needs-triage
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Hello Hasura 🖤

The [new cache implementation of Apollo 3.0](https://blog.apollographql.com/previewing-the-apollo-client-3-cache-565fadd6a01e) , And more specifically their `typePolicies ` depend heavily on `__typename` .

If we want to have proper caching we need to pass this type information around. Unfortunately, when we want to do a mutation, and send back objects with `__typename` to hasura, it doesn't work because `*_arr_rel_insert_input` & `insert_input` don't have that field defined.

There are [some hacky ways to strip the __typename field before passing the data to the mutation](https://github.com/apollographql/apollo-feature-requests/issues/6 ).

So, what is your opinion on the matter? Does it make sense for the `__typename` to be included in `*_arr_rel_insert_input` & `insert_input`, or should we strip the input before executing the mutation ?

I personally don't like both "solutions", but ideally what we want to achieve is to be able to store what we read without any hacks.

Best,B.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how GraphQL schemas define *_arr_rel_insert_input and insert_input, then compare that behavior with Apollo 3.0 typePolicies and the linked cache workaround. Determine whether accepting __typename or stripping it is the intended API behavior, and document the decision and its expected mutation semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql
Domain
api
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.