The Grafbase Database is deprecated. Use connectors to federate your existing data sources.
We're extremely happy to announce the release of the @length
directive.
You can now set both min
and max
values for the length of a field value or list:
type Post @model {
title: String @length(min: 10, max: 255)
tags: [String] @length(max: 7)
}
Now if you try to create a Post
that doesn't bide by the rules you'll get an error.
mutation {
postCreate(input: { title: "Length di" }) {
post {
id
title
tags
}
}
}
{
"data": null,
"errors": [
{
"message": "Invalid value for argument \"title\", length 9 is too short, must be more than 10",
"locations": [
{
"line": 2,
"column": 3
}
]
}
]
}
Learn more about working with the @length
directive.
- Grafbase CLI 0.12.0 has been released to include all of the above.
We'd love to hear your feedback and ideas, so join us on Discord.