ENUM types allow returning values other than the specified values
- Ngôn ngữ chính
- Go
- Star
- 10.8k
- Fork
- 1.3k
- Merge trung bình
- 2 ngày 36 phút
- Pull request đã merge (30 ngày)
- 26
Mô tả
### What happened?
The server allows returning values for enums that aren't in the listed values for the enum types.
### What did you expect?
Spec doesn't allow this https://spec.graphql.org/June2018/#sec-Enums -> Result Coercion:
"GraphQL services must return one of the defined set of possible values. If a reasonable coercion is not possible they must raise a field error."
### Minimal graphql.schema and models to reproduce
Add an enum to the default schema
```graphql
type Todo {
...
type: TodoType!
}
enum TodoType {
WORK
PLAY
}
```
With resolver
```go
func (r *todoResolver) Type(ctx context.Context, obj *model.Todo) (model.TodoType, error) {
return model.TodoType("rubbish"), nil
}
```
### versions
- `gqlgen version` : 0.13.0
- `go version` : go version go1.13.15 darwin/amd64
- dep or go modules : modules
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.