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
GraphQL cannot validate the length of a list. You need to include this validation logic as part of your resolver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With