FSharp.Data.GraphQL
FSharp.Data.GraphQL copied to clipboard
@id or @unique directive
Dgraph has a directive that ensures a unique field value. Do we need a directive like that?
I'm afraid that's too Dgraph-specific. Apart from that, I'm trying to figure out how this would be implemented in FSharp.Data.GraphQL. How would we ensure that the value of a field annotated with @id
or @unique
is not already taken?
I didn't know about Dgraph until now, but according to their own description, they're a "GraphQL database". In this case, I can understand how it would be possible for them to easily verify the uniqueness of a value, since they're already at the database level. Howevever, FSharp.Data.GraphQL is database-agnostic.
Now that I write about it I'm thinking about a way to achieve this: defining a directive with a handler function that ensures the uniqueness of that field. The only problem is that if we implemented it like this, then the semantics of @id
in FSharp.Data.GraphQL would be application-specific instead of framework-specific, meaning that, in the end, the feature would be only that we can define custom directives. Isn't it already possible in the current version of FSharp.Data.GraphQL? Sorry, I didn't look it up yet.