99designs / 99designs/gqlgen

Omit return values for interface/union options that aren't specified with inline fragments

Aberta
#2,511 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Go
Estrelas
10.8k
Forks
1.3k
Merge médio
2d 36min
PRs com merge (30d)
26

Descrição

### What happened?

When a user queries for specific types of an interface and only wants one type in the response, an empty map is returned for the unspecified fragments/types.

### What did you expect?

The option should be provided for those empty maps to be omitted.

### Minimal graphql.schema and models to reproduce

schema:
```
interface Animal {
id string
}

type Dog implements Animal {
furLength int
id string
}

type Cat implements Animal {
meowPitch int
id string
}

```
and a query for:
```
animals {
... on Dog {
furLength
id
}
}
```
would potentially return two objects in the array, one empty and one expected. The empty ones should be omitted

### versions
- `go run github.com/99designs/gqlgen version`? 0.17.22
- `go version`? 1.19.4

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.