walmartlabs / lacinia

GraphQL implementation in pure Clojure
http://lacinia.readthedocs.io/en/latest/
Other
1.82k stars 160 forks source link

Issue with merging fragments with list #457

Open mt3593 opened 6 months ago

mt3593 commented 6 months ago

Hi,

First off brilliant library, getting lots of value out of it.

I updated the library to the latest from 1.2 to 1.2.2, which contained this fix https://github.com/walmartlabs/lacinia/pull/452 it was for this fix that I did the update as we also hit the same issue.

The side effect of this now is that the last fragment or list blats the previous data results. Understand that doesn't make a lot of sense but let's say I have this:

query Foo {
  level1 {
    ...Frag_1
    edges {
      node {
        id
        name
      }
    }
  }
}

fragment Frag_1 on Node {
  edges {
    node {
      id
      type
    }
  }
}

You can see that the frag is also now creating a list of nodes. But the Frag_1 has the type field and non fragment version has the name. The result of this means the last sequence wins, so in the above it will be the non fragment version. Where as it would be the fragment version if that was last in the above.

I'll see if I can get a test setup to show what I mean.