4

I'm learning GraphQL now and I faced a problem that I am unable to resolve.

i have defined type in schema as

input School { name: String! exams: [subject!]! } input subject { name: String! mark: Number! }

But while running the server. I give data as "data": { "name":"varun", "exams":[], }

Server does not throw any validation error. Please suggest me solution. Is there any possible way to get validation error on passing exams as empty array.

I have tried alternate methods, but nothing works on schema level. I have to put a check explicitly to check exam field should not be an empty array. Thanks

0

1 Answer 1

6

GraphQL cannot validate the length of a list. You need to include this validation logic as part of your resolver.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.