-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
gqlgen is confused when the configured model type is a string #670
Comments
I'm not sure I understand. Why have you mapped a GraphQL object type to a Go scalar? |
Because it make sense in my project. A label is no more than a string, but in go I can still attach some function on it like the color (computed from the string). Having a struct hold a string is quite ackward. |
Sure I understand that part. I mean why have you explicitly mapped it in |
Sorry I forgot that part in the issue, but I mapped to the |
Ah ok I understand your problem now, so this looks like a bug to me if it's generating you the Label resolvers, but returning the scalar value before hitting them. |
@MichaelMure could you take a look over #706 and see if you can reproduce this issue in a test? |
@vektah as my initial bug report was about a mapping to a string,I tried that (https://github.com/MichaelMure/gqlgen/tree/mapping-primitive, feel free to pull). It's failing with:
Let me know if I got something wrong. |
What happened?
In this PR for my project, there is a
Label
type in the schema, mapped to aLabel
go type, which is also astring
. In this case, gqlgen is confused and return the data is if it was a scalar:the go type:
relevant part of the schema:
query:
result:
What did you expect?
The data should have the same shape than the query. Color should be present as well.
versions
gqlgen version
: 0.8.3go version
? go1.11.6The text was updated successfully, but these errors were encountered: