-
Notifications
You must be signed in to change notification settings - Fork 197
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
entgql: use goModel directive for mapping #247
Conversation
80a3754
to
f605e3d
Compare
directives = map[string]*ast.DirectiveDefinition{ | ||
"goModel": { | ||
Name: "goModel", | ||
Position: pos, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
position can be set to nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's needed here, but not in other places.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x150c2c2]
goroutine 1 [running]:
github.com/vektah/gqlparser/v2/formatter.(*formatter).FormatDirectiveDefinition(0x15a7f60, 0xc000347a40)
https://github.com/vektah/gqlparser/blob/master/formatter/formatter.go#L326-L328
093d839
to
5b4f311
Compare
In case the GraphQL node name is different than Ent name, autobind won't work, and we need to map it explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
How to mapping the custom type CategoryConfig to GoType with the goModel directive? |
I'll map fields with custom GoType in a different PR. |
In case the GraphQL node name is different from the Ent name,
autobind
won't work, and we need to map it explicitly.