99designs / 99designs/gqlgen

Support for response.body.extensions on successful response?

Offen
#3,019 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
10.8k
Forks
1.3k
Ø Merge
2 T. 36 Min.
Gemergte PRs (30 T.)
26

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.