Schema naming collision causes compilation error
- Dominant language
- Go
- Stars
- 10.8k
- Forks
- 1.3k
- Avg merge
- 2d 36m
- Merged PRs (30d)
- 26
Description
### What happened?
Expanding on https://github.com/99designs/gqlgen/discussions/2040#discussion-3929370
This is an ongoing issue if you have two fields with different casing within the same type. They're not clashing per GraphQL spec, however - when generated into a struct, the names are exactly the same and it causes a compilation issue.
```gql
type MyQuery {
field_name: String
fieldName: String
}
```
```go
type MyQueryValue struct {
FieldName *bool `json:"field_name,omitempty"`
FieldName *bool `json:"fieldName,omitempty"`
}
```
### What did you expect?
I'd expect that there's a way to handle this similar to how the documentation suggests enum name collision is dealt with.
https://gqlgen.com/reference/name-collision
```gql
type MyQuery {
field_name: String
fieldName: String
}
```
```go
type MyQueryValue struct {
FieldName *bool `json:"field_name,omitempty"`
FieldName0 *bool `json:"fieldName,omitempty"`
}
```
### Minimal graphql.schema and models to reproduce
See above
### versions
- `go run github.com/99designs/gqlgen version`? - v0.17.36
- `go version`? - go version go1.20.5 darwin/arm64
Contributor guide
Assessment
This issue has not been assessed yet.