Batch requests #6
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ok, this is ugly as hell, but maybe a starting point for discussion.
I've changed the logic of
HttpDirectiveProvider
to return aRequestDescription <: Deferred[Json]
and created aRequestResolver <: DeferredResolver[GatewayContext]
which performs the actual logic.In principle one could now go ahead and transform a
Vector[RequestDescription]
into batch requests, but there's too many things that feel just awfully wrong:RequestDescription
needs to store the entireContext[GatewayContext, _]
so that theRequestResolver
can execute its logic. It would be much nicer if it would suffice to have aGatewayContext
which would be theCtx
ofRequestResolver
anyway, butContext[GatewayContext, _]
is needed forfillPlaceholders
.schemaInfo.deferredResolver
. It seems that it's an empty resolver by default.Fetcher
API. The point where I got stuck with this is that aFetcher
needs aHasId[Res, Id]
, soId
can't be something complicated like myRequestDescription
. But if I makeId
something simple like aJson
object, I wouldn't know how to get all the other required things into theFetcher
.If you have any ideas how to make this nicer I'd be very thankful 😃