relay-tools/relay-compiler-language-typescript

Why relay-compiler adding id when it has been aliased on __generated__ file? [question]

mhermosi opened this issue · 0 comments

I have some types and queries on schema.graphql like these ones:

type UserType {
    id: ID!
    firstName: String!
    lastName: String!
    email: String!
    isActive: Boolean!
    createdAt: DateTime!
    updatedAt: DateTime!
}

type CommentType {
    id: ID!
    entryId: ID!
    parentId: ID!
    text: String!
    author: UserType
    createdAt: DateTime!
    updatedAt: DateTime!
}

type Query {
    user(userId: ID): UserType
    users: [UserType]

    comment(commentId: ID): CommentType
    comments(serviceName: String, entryId: ID): [CommentType]
}

then on query:

const commentsQuery = graphql`
    query commentsQuery($serviceName: String, $entryId: ID) {
      comments(serviceName: $serviceName, entryId: $entryId) {
          commentId: id
          text
          entryId
          parentId
          author  {
              authorId: id
              firstName
              lastName
              email
          }
          createdAt
          updatedAt
      }
    }
`;

I have aliased commentId and authorId

but the generated commentsQuerygraphql.js on __generated__ folder has appended id on each type
raising the error related to the global unique id.

Is that an expected behavior? if so... how can I fix that

Thanks