graphql icon indicating copy to clipboard operation
graphql copied to clipboard

Alias is not working on "wrapper" fields

Open Andy2003 opened this issue 5 months ago • 6 comments

Its not possible to add an alias to each level of the projection.

Type definitions

type Movie {
  title: String!
  actors: [Actor!]! @relationship(type: "ACTED_IN", properties: "ActedIn", direction: IN)
}

type Actor {
  name: String!
  movies: [Movie!]! @relationship(type: "ACTED_IN", properties: "ActedIn", direction: OUT)
}

type ActedIn @relationshipProperties {
  screenTime: Int!
}

To Reproduce

Run the query

{
                movies(where: { title: "The Matrix" }) {
                    title1: title
                    actorsConnection1: actorsConnection(where: { node: { name: "Keanu Reeves" } }) {
                        edges1: edges {
                            properties1: properties {
                                screenTime1: screenTime
                            }
                            node1: node {
                                name1: name
                                b: moviesConnection(where: { node: { title: "The Matrix"}}) {
                                    edges2: edges {
                                        node2: node {
                                            title2: title
                                            a: actors {
                                                name2: name
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

Error: Cannot read properties of undefined (reading 'edges')

Additional context

Aliases are currently not supported at "wrapper" fields. I think this is a low priority bug, but since the grapqhl spec allows aliases on each field, we should support these cases as well.

Andy2003 avatar Sep 20 '24 14:09 Andy2003