-
Notifications
You must be signed in to change notification settings - Fork 194
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: create plugin for gqlgen [Stage1] #241
Conversation
da4957b
to
a772776
Compare
0948072
to
add22b7
Compare
2ef09aa
to
3b980d2
Compare
3b980d2
to
ce3256a
Compare
f73d0e9
to
28e280b
Compare
entgql/internal/todoplugin/ent/schema/durationgql/durationgql.go
Outdated
Show resolved
Hide resolved
) | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, err.Error()) | ||
os.Exit(3) |
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.
Why exit code 3?
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.
Not sure, it's come from the original PR. I can fix it by update to Fatal().
entgql/internal/todoplugin/ent/schema/durationgql/durationgql.go
Outdated
Show resolved
Hide resolved
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.
Great progress! I'm going to merge this, even though it's not finished, but I can help with that.
@@ -188,6 +193,14 @@ func WithWhereFilters(b bool) ExtensionOption { | |||
} | |||
} | |||
|
|||
// WithSchemaGenerator add a hook for generate GQL schema | |||
func WithSchemaGenerator() ExtensionOption { |
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.
💯
That means users can use it even if they don't use gqlgen.
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.
Yes, but it require some refactor for WhereInput feature to working as the same way
} | ||
} | ||
|
||
type gqlgenPlugin struct { |
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.
Nice, but it's actually more complex than setting autobind
or the @goModel
directive in the generated schema.
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.
autobind didnt work in all cases. So, the user still need to manual config mapping. Then, we have to read config.yaml to recogine them.
If we can detect and mapping it correctly, we not need to read config.yaml anymore and not must to depends on gqlgen.
@cliedeman, I added you as a co-author of this PR. Thank you both for your contribution ❤️ 🙏 |
Related: ent/ent#2351