0

I want to create query with multi options for parameter

Example:

My query is query ($username: String, $phone: String, $name: String)

When work I can type:

`query (username: "08789456")`

or query (username: "08789456", name: "Ryan")

It can have many option parameter but can not use all them.

Võ Cát Thư
  • 47
  • 2
  • 9
  • Actually, you can better handle it in resolvers and in the gql schema itself. – Shivam Pandey Oct 02 '18 at 05:39
  • @ShivamPandey. hi, you have example for this. i have learn graphql yesterday. so I don't understand what you said. i'm sorry – Võ Cát Thư Oct 02 '18 at 06:15
  • yes, clone this repo https://github.com/shivamkrpandey/accounts-stoverflow and run it. Resolvers are in the schema.js(https://github.com/shivamkrpandey/accounts-stoverflow/blob/master/schema/schema.js) file. – Shivam Pandey Oct 02 '18 at 06:19
  • @ShivamPandey I wrote resolvers look like you. But when resolver have many args, but I can use all or can not use all them. Example I have 2 args is `id` and `username`. Something I use both or only one, but query can work if have one or both all. – Võ Cát Thư Oct 02 '18 at 06:29
  • same way you choose field data to return `addAccount(name: "Test") { id _id name } ` or `addAccount(name: "Test") { name } ` – Võ Cát Thư Oct 02 '18 at 06:31

0 Answers0