prisma-labs / graphqlgen

⚙️ Generate type-safe resolvers based upon your GraphQL Schema
MIT License
818 stars 54 forks source link

Incorrect type for arrays of arrays resolver #457

Open sarfata opened 5 years ago

sarfata commented 5 years ago

Description

Graphqlgen does not seem to handle arrays of arrays properly. Instead, it treats them as 1 dimensional array.

Steps to reproduce

yarn create graphqlgen my-app

Edit the schema.graphql file and add a field data inside the type Post:

type Post {
  id: ID!
  title: String!
  content: String!
  published: Boolean!
  author: User!
  data: [[Float]!]!
}

Expected results

PostResolvers.type should define a data resolver that returns an array of array of number.

Something like:

    data: (
      parent: Post,
      args: {},
      ctx: Context,
      info: GraphQLResolveInfo
    ) => Array<Array<number | null>> | Promise<Array<Array<number | null>>>;

Actual results

Instead this is what is generated:

    data: (
      parent: Post,
      args: {},
      ctx: Context,
      info: GraphQLResolveInfo
    ) => Array<number | null> | Promise<Array<number | null>>;

Versions

sarfata commented 5 years ago

Also tested with 0.6.0-rc9. Same behavior.

devakrishna33 commented 4 years ago

Any updates on this?