99designs / 99designs/gqlgen

Autobind error message is wrong

Open
#2,688 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.8k
Forks
1.3k
Avg merge
2d 36m
Merged PRs (30d)
26

Description

### What happened?

```graphql
type User {
tags: [String!]!
}
```

```go
type User struct {
tags string
}
```

If I exec gqlgen, I get the following error.

`2023/06/22 03:31:20 String is incompatible with string`

The reason for this is not clear, since `String` and `string` are supposed to be bindable.

### What did you expect?

`2023/06/22 03:31:20 [String!]! is incompatible with string`

It is also more desirable if the corresponding file and line are output.

`2023/06/22 03:31:20 user.graphql:2 [String] is incompatible with string`

### Minimal graphql.schema and models to reproduce

```graphql
type User {
tags: [String!]!
}
```

### versions
- `go run github.com/99designs/gqlgen version`? v0.17.28
- `go version`? 1.20

Contributor guide

Open the contributing guide

Research direction

The error message is generated in the code generation or validation logic. Look for where type incompatibility errors are formatted, likely in a package like 'codegen' or 'validation'. The issue shows the current output 'String is incompatible with string' but expects '[String!]! is incompatible with string' with file and line. Start by finding the function that prints this error, then trace how it resolves types. Check test files for error messages to understand the expected format.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, graphql
Domain
backend-api-design, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.