What feature are you missing?
As I understand from the docs that as of now, it is not possible to set a default value for DateTime field via @default directive.
Currently, I am doing this at the application (graphql-yoga) level.
How could this feature look like in detail? Tradeoffs?
It should be possible to provide an "@default" value for DateTime.
type Post
{
publishDate DateTime! @default(value: "<ISO Date>")
}
More thought needs to be given to handling things like setting NOW as the default DateTime value (and making that agnostic of the store).
I would love to hear the thoughts of Graphcool team on this and see if we can elaborate this proposal.
Thanks!
It's possible to set static default values for DateTime:
type Post
{
publishDate DateTime! @default(value: "2018-01-26T06:16:12.123Z")
}
Dynamic default values are best set in the application layer, as you're already doing.
Over time, we might add special instructions for certain dynamic (like "now" for DateTime, or "max + 1" for Int).
I'm closing this for now, feel free to create a separate issue for dynamic default values.
@marktani please do add it. Any concrete plans or that's far in the future?
Most helpful comment
@marktani please do add it. Any concrete plans or that's far in the future?