Skip to content

feat: load gqlgen plugins during parse schema#199

Merged
a8m merged 8 commits intoent:masterfrom
giautm:giautm/gqlgen-load-plugins
Jan 7, 2022
Merged

feat: load gqlgen plugins during parse schema#199
a8m merged 8 commits intoent:masterfrom
giautm:giautm/gqlgen-load-plugins

Conversation

@giautm
Copy link
Collaborator

@giautm giautm commented Jan 5, 2022

Currently, the EntGQL extension didn't load any GQLGen plugins. So, When I use Federations (it's a built-in GQLGen plugin), EntGQL complains about undefined @key directives which will be defined by the plugin via code-mod.

# Todo with Federations enabled
type Todo implements Node @key(fields: "id") {
  id: ID!
  createdAt: Time
  status: Status!
  priority: Int!
  text: String!
  parent: Todo
  children: [Todo!]
}

Current error

2022/01/05 10:43:17 creating EntGQL extension: internal/graphql/schema/schema.gql:54: Undefined directive key.
exit status 1

This PR loads built-in plugins from GQLGen, and also provides options to load third-party plugins.

Copy link
Collaborator

@masseelch masseelch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for this?

@giautm
Copy link
Collaborator Author

giautm commented Jan 5, 2022

What kind of test? 😁 trying to enable federation?!

Co-authored-by: MasseElch <12862103+masseelch@users.noreply.github.com>
@giautm
Copy link
Collaborator Author

giautm commented Jan 5, 2022

Hey @masseelch, plz review again. 🥰

@masseelch
Copy link
Collaborator

masseelch commented Jan 5, 2022

This is what I meant yes. Though I advise to let todo, todopulid and todouuid unchanged and simply add another dir liketodofed or similar. Looks great otherwise 👍

And we need to see if @a8m is willing to merge it :-)

@giautm giautm force-pushed the giautm/gqlgen-load-plugins branch from 17b5b93 to 38452c0 Compare January 5, 2022 14:31
@giautm
Copy link
Collaborator Author

giautm commented Jan 5, 2022

Updated PR with todofed, and unchanges other apps.

Copy link
Collaborator

@masseelch masseelch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :-)

Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🚀

Add minor style comments and a few thoughts.

giautm and others added 3 commits January 7, 2022 23:15
@a8m a8m merged commit a551ba9 into ent:master Jan 7, 2022
@a8m
Copy link
Member

a8m commented Jan 7, 2022

Thanks for the contribution @giautm ❤️

@giautm giautm deleted the giautm/gqlgen-load-plugins branch January 7, 2022 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants