artemis icon indicating copy to clipboard operation
artemis copied to clipboard

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

Open namanshergill opened this issue 4 years ago • 2 comments

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?

namanshergill avatar May 28 '21 16:05 namanshergill

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

vasilich6107 avatar Jun 02 '21 18:06 vasilich6107

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?

namanshergill avatar Jun 06 '21 06:06 namanshergill