Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@id or @unique directive #416

Open
xperiandri opened this issue Dec 16, 2022 · 1 comment
Open

@id or @unique directive #416

xperiandri opened this issue Dec 16, 2022 · 1 comment

Comments

@xperiandri
Copy link
Collaborator

Dgraph has a directive that ensures a unique field value.
Do we need a directive like that?

@valbers
Copy link
Collaborator

valbers commented Mar 21, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants