I'm using Sangria for a Play application and currently struggling to implement the schema definition. The Problem is, that the service does not return the needed object directly, it returns an EitherT containing the object.
Here are some code examples
case class
case class User(name: String, age: Int)
UserService
def user(): EitherT[Future, AbstractError, User] = {...}
If the service would return a User
instead of a EitherT[Future, AbstractError, User]
I would derive the schema like this:
Schema
val UserType = deriveObjectType[UserService, User](
ObjectTypeName("User"),
ObjectTypeDescription("A simple user."))
Do I have to implement an additional layer to extract the User
from the EitherT
object or is there another way to handle this situation?