Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Array of required type in schema is not correctly maintained in queries #16

Open
NoTuxNoBux opened this issue Sep 14, 2021 · 1 comment

Comments

@NoTuxNoBux
Copy link
Contributor

Hello

I have a GraphQL schema that looks somewhat like this. (I abbreviated it for brevity, but it should still be mostly complete, it was automatically generated by Keystone 6, also known as Keystone Next):

type Query {
  sharedExperienceRooms(
    where: SharedExperienceRoomWhereInput! = {}
    orderBy: [SharedExperienceRoomOrderByInput!]! = []
    take: Int
    skip: Int! = 0
  ): [SharedExperienceRoom!]
}

type SharedExperienceRoom {
  id: ID!
  serverHost: String
}

input SharedExperienceRoomOrderByInput {
  id: OrderDirection
}

enum OrderDirection {
  asc
  desc
}

input SharedExperienceRoomWhereInput {
  id: IDFilter
}

input IDFilter {
  equals: ID
  in: [ID!]
  notIn: [ID!]
  lt: ID
  lte: ID
  gt: ID
  gte: ID
  not: IDFilter
}

I've then scaffolded the appropriate classes, and am the using the generated query context to do a query to fetch all items as follows:

var query = queryContext.SharedExperienceRooms(new SharedExperienceRoomWhereInput(), new List<SharedExperienceRoomOrderByInput>(), null, 0);

After that, I get the following query as output from GraphQLinq:

query (
  $where: SharedExperienceRoomWhereInput
  $orderBy: [SharedExperienceRoomOrderByInput]
  $skip: Int
) {
  result: sharedexperiencerooms(where: {}, orderBy: [], skip: 0) {
    id
  }
}

However, next to the issue from #15, this query contains $orderBy: [SharedExperienceRoomOrderByInput] instead of $orderBy: [SharedExperienceRoomOrderByInput!] (note the exclamation mark) from the original schema, which generates syntax errors on the side of the server.

@Giorgi
Copy link
Owner

Giorgi commented May 18, 2022

Blocked by #22

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants