-
Notifications
You must be signed in to change notification settings - Fork 49
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
Identities with optional results #45
Comments
The current behaviour is actually pretty surprising, that a method with this signature: def fetchOne(id: I): Query[Option[A]] Causes the whole execution to fail. It's not clear why the result is an |
@gregbeech I agree. I was planning to rework |
👍 In particular this would make fetch an even better fit for GraphQL APIs, where the default is to make everything optional, so parts of a query can fail, while others succeed. For example, in the GitHub API if you search for foo and bar and only foo succeeds, you'll see the foo data and and an error at the bar node. This is very challenging to implement with fetch because |
@peterneyens @raulraja Any movement on this? Cats has since stabilized. I'm curious what design changes you had in mind to support this feature. |
The For individual identities you could create an optional fetch doing
Hey @paulpdaniels, I'm working on updating Fetch to work with the latest This means that trait DataSource[I, A] {
def fetchOne[F[_]: Effect](id: I): F[Option[A]]
def fetchMany[F[_]: Effect](ids: NonEmptyList[I]): F[Map[I, A]]
} I've outlined a couple of design changes on the response above but I need to get into implementing optional identities to have a better idea of what would be required to support them. What I have in mind is to enrich Hope it helps, I'll open a PR shortly for the redesign using |
The current semantics of Fetch are that identities must have a result. If a result is missing, the fetch execution short-circuits and fails. Maybe we should support the notion of optional fetches, much like Clump does with the .optional method.
The text was updated successfully, but these errors were encountered: