sangria-graphql/sangria

Change context object

mykytamykhailenko opened this issue · 0 comments

Hi

It would be quite useful if there would a possibility to change the type of the contexts.
So, currently if you have following query:

      val dataInputType: ObjectType[AlternativeContext, Data] = ???
 fields[Context, Unit](
      Field(
        name      = "getData",
        fieldType = dataInputType,
        resolve = c => {
          val fetchSomeData = ???

          UpdateCtx(fetchSomeData)(data => AlternativeContext(data))
        }
      )
)

It would not compile, because you have to use Context

The strange thing is that dataInputType depends on AlternativeContext, yet you still need to adhere to Context

Basically, what I want to achieve is to reduce the contexts size during downstream flow