Default values on input types

Currently it is not possible to declare default values for fields.

The GraphQL spec allows default values on input types: GraphQL

It would be awesome to see support for this on dgraph through a @default field directive:

type Foo {
   value: Int @default(5)
}

would generate this Input-Type:

input AddFooInput {
   value: Int = 5
}

I’ll link this for reference.

4 Likes

Making this into a formal feature request.

3 Likes

Hi Chew, Is there a way for me to track progress on specific features?

@default is available in v 21.12 feat(graphql): adds @default directive for setting default field values at create and update by dpeek · Pull Request #8017 · dgraph-io/dgraph · GitHub

2 Likes