Dgraph GraphQL field validation via @custom()

Moved from GitHub dgraph/5455

Posted by geoyws:

Experience Report

Note: Feature requests are judged based on user experience and modeled on Go Experience Reports. These reports should focus on the problems: they should not focus on and need not propose solutions.

What you wanted to do

Performantly be able to do field validation (min/max integers, regex checks) using Custom Logic or some other directive, without having to resort to HTTP calls. Original discussion here.

What you actually did

Why that wasn’t great, with examples

Any external references to support your case

MichaelJCompton commented :

Thanks. Added into our internal discussions. I’ll repost here if we pick it up and start further scoping of this feature.

machship-mm commented :

I’d also like to see this. Would be particularly handy for collections also to enforce min/max length of the collection.

@core-devs,

If eventually Dgraph decides to introduce validation in GraphQL Schema.

I would like to propose that the team comes up with an API similar to Yup.

I am using it in the front end to send proper data to the backend. See:

  1. Svelte Forms Lib :heart: Yup
  2. Formik :heart: Yup