1

Is it possible to set mutually exclusive args? like:

type Query {
  listings (sellerId: ID! | landlordId: ID!): [Listing]
}

I know that I can let both args as optional:

type Query {
  listings (sellerId: ID, landlordId: ID): [Listing]
}

But that's not what I want, I want the client to necessarily pass either sellerId or landlordId

Is there a way to accomplish this?

GhostOrder
  • 586
  • 7
  • 21
  • Normally I check for this in the query's resolver code. I don't think it can be done directly in the query definition. It might be possible by defining an `input type` that is the `union` of two other types but I'm not sure one can do that. – Michel Floyd Nov 22 '22 at 18:39

0 Answers0