Default directive added

Jakub Wieczorek
Jakub Wieczorek
Jamie Barton
Jamie Barton
Default directive added

We're extremely happy to announce the release of the @default directive.

You can now set default values for fields in your schema using the @default directive:

type Review @model {
  message: String!
  rating: Int @default(value: 5)
  published: Boolean @default(value: false)
}

Now all that's required to create a review is the message value. The rating and published will use the default!

mutation {
  reviewCreate(input: { message: "Awesome product!" }) {
    review {
      id
      message
      rating
      published
    }
  }
}

Learn more about working with the @default directive.

  • Grafbase CLI 0.9.0 has been released to include all of the above.

We'd love to hear your feedback and ideas, so join us on Discord.