Skip to content
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

Extensions Support #1750

Closed
michaelbird1155 opened this issue Feb 17, 2023 · 3 comments · Fixed by #1752
Closed

Extensions Support #1750

michaelbird1155 opened this issue Feb 17, 2023 · 3 comments · Fixed by #1752
Assignees

Comments

@michaelbird1155
Copy link

Is there support for returning an extensions object? I see in the ExecutionResponse that there is already code to add errors, data, and extensions to the response but I haven't found a way to add extensions to the response. I have tried accessing the context object in the @query annotated method to add extensions through the ExecutionInput object but it is too far down the chain of events at that point. Having a way for developers to add to the extensions object is useful for returning metadata to the client about the data and fields that are returned. In my case, a warning that a field is deprecated is very useful.

Graphql-java already has support for instrumentation so I think being able to hook into that functionality is a good route.

@jmartisk
Copy link
Member

Could we perhaps offer a method on the SmallRyeContext, like setExtension(String key, JsonObject value) for this?

@t1
Copy link
Collaborator

t1 commented Feb 17, 2023

Sounds good. Only that the value parameter should be a JsonValue, as it could also be primitive or an array. And maybe we should accept Object and convert it to json automatically.

We probably should also think about how to support extensions on the client side.

@phillip-kruger
Copy link
Member

I would say the value should be any (Json serializable) object. We can make it json in the background. So setExtension(String key, Object value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants