-
-
Notifications
You must be signed in to change notification settings - Fork 466
Closed
Labels
discussionRequires input from multiple peopleRequires input from multiple people
Description
Country ID is mandatory.
input UpdatePersonInput {
country_id: Int!
name: String
}This is pretty clear, by graphql spec itself, and guide users about this API usage. API auto-docs will say it.
The above stuff is a pure schema definition. if user try to send a empty country_id an GraphQL Error is thrown (useless when handling errors on frontend, because there is no definition about fields keys; a big message is thrown).
When using @rules directive errors are friendly, because there are properly field keys. So i can handle it on frontend.
input UpdatePersonInput {
country_id: Int @rules(apply: ["required"])
name: String
}However, it "breaks" the schema definition, because "officially" that field is not mandatory anymore. So API auto-docs get inconsistent (Eg, graphql-playground).
So... what is the best practice in this case?
Metadata
Metadata
Assignees
Labels
discussionRequires input from multiple peopleRequires input from multiple people