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

Support for response.body.extensions on successful response? #3019

Open
JustinSomers opened this issue Apr 26, 2024 · 0 comments
Open

Support for response.body.extensions on successful response? #3019

JustinSomers opened this issue Apr 26, 2024 · 0 comments

Comments

@JustinSomers
Copy link

What happened?

We are trying to replicate the behavior of our Apollo Server based subgraphs. We commonly use the response.body.extensions property from apollo server to add additional information such as additional codes that may occur even on a "successful" response.

Currently, I am able to add extensions parameters by using:

graphql.AddError(ctx, &gqlerror.Error{
	Path:    graphql.GetPath(ctx),
	Message: e.Payload.Message,
	Extensions: map[string]interface{}{
		"code":            e.Payload.Code,
		"status":          e.Payload.Status,
		"ErrorCode": e.Payload.ErrorCode,
	},
})

However, it would be valuable to also to add to the extensions object when a success is returned too.

What did you expect?

Something like graphql.AddExtensions(ctx, myCustomExtensionObject) would be helpful.

Minimal graphql.schema and models to reproduce

versions

  • v0.17.43
  • go version go1.21.6
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

No branches or pull requests

1 participant