graphql-to-openapi icon indicating copy to clipboard operation
graphql-to-openapi copied to clipboard

Multiple references to the same field within the same object are not merged

Open nbudin opened this issue 1 year ago • 0 comments

Describe the bug

Referencing the same field multiple times within the same object should merge all the referenced subfields inside that field together, but currently this doesn't happen - instead, the last reference to a field overwrites all previous ones.

To Reproduce This query reproduces the issue:

query fieldMerging($id: ID!) {
  person(id: $id) {
    id
    firstName
    lastName

    address {
      country
    }

    address {
      city
      state
    }
  }
}

Expected behavior The resulting OpenAPI schema should include country, city, and state in the address property of person, but it only includes city and state.

Desktop (please complete the following information):

  • OS: macOS 14.7
  • Node v20.18.0

Additional context I've also tested this using fragment spreads, and they have the same incorrect behavior.

nbudin avatar Oct 11 '24 19:10 nbudin