leangen / graphql-spqr

Build a GraphQL service in seconds
Apache License 2.0
1.09k stars 179 forks source link

@GraphQLContext doesn't support graphql.GraphQLContext #405

Closed GoodforGod closed 1 year ago

GoodforGod commented 2 years ago

Expected behavior of @GraphQLContext annotation is to retrieve data from context, however it only support retrieval Only Maps or via reflection through getters from any class check RootContextInjector

However there is "native" GraphQLContext entity that is supposed to represent such context and it is not supported it SPQR.

I think that this will be logical to add support in RootContextInjector for graphql.GraphQLContext

GoodforGod commented 2 years ago

I can implement this and propose PR for such feature

kaqqao commented 2 years ago

You're right, this is indeed missing. I'd be happy to merge a PR adding that. Btw, the annotation applicable here is @GraphQLRootContext, not @GraphQLContext. This is an unfortunate quirk of history (GraphQL used to treat contexts differently in its early days) that I'll probably have to do something about.

GoodforGod commented 2 years ago

Yea I meant @GraphQLRootContext, just miss type on my side I created a PR with such feature, looking for your review, thanks!