# Default values on input types

**URL:** <https://discuss.dgraph.io/t/default-values-on-input-types/13448>\
**Category:** GraphQL\
**Tags:** kind:enhancement, kind:feature\
**Created:** [March 29, 2021, 2:16pm UTC](https://discuss.dgraph.io/t/default-values-on-input-types/13448 "2021-03-29T14:16:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maaft](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maaft](https://discuss.dgraph.io/u/maaft)\
**Post date:** [March 29, 2021, 2:16pm UTC](https://discuss.dgraph.io/t/default-values-on-input-types/13448/1 "2021-03-29T14:16:52Z")

</div>

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

The GraphQL spec allows default values on input types: [GraphQL](http://spec.graphql.org/June2018/#DefaultValue)

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

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

```

would generate this Input-Type:

```auto
input AddFooInput {
   value: Int = 5
}

```

I’ll link [this](http://discuss.hypermode.com/t/schema-migration-default-values-for-fields/11178/8) for reference.

---

<div class="post-metadata">

**Author:** ![chewxy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/chewxy/32/4339_2.png) [@chewxy](https://discuss.dgraph.io/u/chewxy)\
**Post date:** [March 29, 2021, 11:36pm UTC](https://discuss.dgraph.io/t/default-values-on-input-types/13448/2 "2021-03-29T23:36:21Z")

</div>

Making this into a formal feature request.

---

<div class="post-metadata">

**Author:** ![BenW](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/benw/32/7532_2.png) [@BenW](https://discuss.dgraph.io/u/BenW)\
**Post date:** [July 9, 2021, 6:20am UTC](https://discuss.dgraph.io/t/default-values-on-input-types/13448/3 "2021-07-09T06:20:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ansonhwang](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ansonhwang/32/9117_2.png) [@ansonhwang](https://discuss.dgraph.io/u/ansonhwang)\
**Post date:** [January 12, 2022, 1:42am UTC](https://discuss.dgraph.io/t/default-values-on-input-types/13448/4 "2022-01-12T01:42:28Z")

</div>

@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](https://github.com/dgraph-io/dgraph/pull/8017)
