Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicTypes "Byte" Binding for Scalars fails #2524

Closed
roneli opened this issue Jan 25, 2023 · 0 comments · Fixed by #2528
Closed

BasicTypes "Byte" Binding for Scalars fails #2524

roneli opened this issue Jan 25, 2023 · 0 comments · Fixed by #2528

Comments

@roneli
Copy link
Contributor

roneli commented Jan 25, 2023

What happened?

Since #2486 some common types don't get binded correctly

What did you expect?

Bytes to be binded to []bytes.

What happens that in this new function introduced in #2486

func similarBasicKind(kind types.BasicKind) types.BasicKind {

Converts some basic kinds to "similar" types which makes sense in some cases as gqlgen converts Int into multiple types of int.

But in this case where we do the check in :

if similarBasicKind(actualBasic.Kind()) != expected.Kind() {

It will fail as similar will convert byte -> int64 != byte.

Minimal graphql.schema and models to reproduce

scalar Bytes

type SomeBytesType {
   value: Bytes
}

And we add to the gqlgen the scalar + Unmarshal

versions

  • go run github.com/99designs/gqlgen version? 0.17.24
  • go version? 1.18
roneli added a commit to roneli/gqlgen that referenced this issue Jan 25, 2023
Found and issue from v0.17.24+ with binding bytes type

Fixes 99designs#2524
mstephano added a commit to mstephano/gqlgen that referenced this issue Jan 26, 2023
mstephano added a commit to mstephano/gqlgen that referenced this issue Jan 26, 2023
mstephano added a commit to mstephano/gqlgen that referenced this issue Jan 26, 2023
StevenACoffman pushed a commit that referenced this issue Jan 27, 2023
* fix #2524 basic alias `Byte` was not binded properly

* add tests for defined types as []byte and []rune
StevenACoffman added a commit that referenced this issue Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant