99designs / 99designs/gqlgen

List input coercion not work with enum provided as variable

Abierto
#1,732 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
10.8k
Forks
1.3k
Merge medio
2 d 36 min
PR fusionados (30 d)
26

Descripción

### What happened?

When you send query graphql is able to coerce single value to an array:

```graphql
# WOKS!
query vessels {
vessels(shipType: [CAR_CARRIER]) {
nodes {
id
}
}
}
```

```graphql
# WORKS!
query vessels {
vessels(shipType: CAR_CARRIER) {
nodes {
id
}
}
}
```

But when enum value submitted via variables, the coercion does not work:

```graphql
# FAILS!
query vessels($shipType: [ShipType!]) {
vessels(shipType: $shipType) {
nodes {
id
}
}
}
```

with variables:
```json
{
"shipType": "CAR_CARRIER"
}
```

with message `"enums must be strings"`

### What did you expect?

Array coercion works for variables.

### Minimal graphql.schema and models to reproduce

```graphql
type Query {
vessels(shipType: [ShipType!]!): [Vessel]
}

enum ShipType {
CAR_CARRIER
}

```

### versions
- `gqlgen version` - v0.14.0
- `go version` - go 1.17.2

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.