google / rejoiner

Generates a unified GraphQL schema from gRPC microservices and other Protobuf sources
https://google.github.io/rejoiner/
Apache License 2.0
3.67k stars 139 forks source link

Metadata HTTP forwarding #81

Open FrancoisChastel opened 5 years ago

FrancoisChastel commented 5 years ago

Hello All !

I am currently planning to use rejoiner for exposing a single HTTP endpoint for a public API on one of my project.

In this context, I need to be able to retrieve the usual metadata which is inside an HTTP request (user-agent,etc...).

After looking quickly in the code I couldn't find any mention of it in the codebase.

sheepdreamofandroids commented 5 years ago

Rejoiner doesn't. It cannot know what metadata is important to you and how it should be transmitted.

But in your endpoint, which can be a standard servlet, you can collect any metadata you like into an object of your choice and stick it into the ExecutionInput as "context". This context is available in any @Query or @SchemaModification annotated method from the DataFetchingEnvironment parameter.

siderakis commented 5 years ago

@FrancoisChastel Did that answer you question? How would you like it to work? Is there something we can automate?

FrancoisChastel commented 5 years ago

@siderakis I think having in the query in the gRPC-side something like a context object in the proto-definition of the services which contains the usual HTTP metadata as mentioned would be a great improvement, we could have a seamless experience of the rejoiner integration with the HTTP-Rest "world"