Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Is it possible to generate same classes for the same type of inline fragment that is under different unions? #316

Open
NamanShergill opened this issue May 28, 2021 · 2 comments

Comments

@NamanShergill
Copy link

NamanShergill commented May 28, 2021

for example,

query {
  x{
   _typename
   ...on A{
    ...fragment
  }
}

and

query {
  y{
   __typename 
   ...on A{
    ...fragment
  }
}

Where x and y are different unions including A.
The reference to A for both queries will generate different classes. How to write these queries in such a way that it generates the same class like ...fragment would?

@vasilich6107
Copy link
Collaborator

vasilich6107 commented Jun 2, 2021

Try to use fragmnets like this

query {
  y{
   __typename 
 
    ...fragment
}

It will generate separete mixins and you'll be able to refer to them as obj is FragmentMixin

@NamanShergill
Copy link
Author

Try to use fragmnets like this

query {
 y{
  __typename 

   ...fragment
}

It will generate separete mixins and you'll be able to refer to them as obj is FragmentMixin

Can I do this for inline fragments? How will I write such a fragment when the fragment x on Y part of the code can't be written without knowing what Y is beforehand?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants