-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Http4s simple integration #100
Conversation
object dsl extends Http4sDsl[RIO[R0, *]] | ||
import dsl._ | ||
for { | ||
query <- req.attemptAs[GraphQLRequest].value.absolve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract this block into a function so that it's not repeated here and in makeRestService
?
query <- req.attemptAs[GraphQLRequest].value.absolve
result <- execute(interpreter, query)
.foldCause(cause => GraphQLResponse(NullValue, cause.defects).asJson, _.asJson)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looks like good idea but in executeRequest I work with Request/Response with environment R0 and executor is in environment R, so it would mean doing two mapK
which I do not like much and I find it now more simple. Or I can to common method provideSome
and send indentity
from makeRestService
which also not nice. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see what you mean. I'd prefer to avoid an unnecessary provideSome
for general case. How about just moving execute(interpreter, query).foldCause(cause => GraphQLResponse(NullValue, cause.defects).asJson, _.asJson)
to a function?
Can you also add a variant |
Sure, I added |
Thanks! |
This allows for simple integrations where we can do things like: