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

Add a plugin for configuring gqlgen via directives #732

Merged
merged 5 commits into from
Jun 26, 2019

Conversation

lwc
Copy link
Member

@lwc lwc commented May 30, 2019

Uses the plugin system / MutateConfig interface to allow for gqlgen configuration directly in the schema files, via two directives:

directive @goModel(model: String, models: [String!]) on OBJECT 
    | INPUT_OBJECT 
    | SCALAR 
    | ENUM 
    | INTERFACE 
    | UNION

directive @goField(forceResolver: Boolean, name: String) on INPUT_FIELD_DEFINITION 
    | FIELD_DEFINITION

I think this captures all the features available in gqlgen.yml.

Benefits

  • Config lives alongside the schema
  • Allows config to be split across multiple schema files

Questions

  • Naming is hard - originally I'd called these bind and field but was concerned they were too vague. Thoughts?

Supersedes: #727
Fixes: #587, #726

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

I'll update docs if we decide to go ahead with this approach

@sunfmin
Copy link
Contributor

sunfmin commented Jun 4, 2019

make these directives builtin? Or better not?

@coveralls
Copy link

coveralls commented Jun 26, 2019

Coverage Status

Coverage decreased (-0.8%) to 61.896% when pulling c14f865 on schemaconfig-plugin into 5e7e94c on master.

@vektah vektah merged commit fc3755f into master Jun 26, 2019
@vektah vektah deleted the schemaconfig-plugin branch June 26, 2019 07:19
@vektah vektah added the v0.9.1 fixed in v0.9.1 label Jun 27, 2019
cgxxv pushed a commit to cgxxv/gqlgen that referenced this pull request Mar 25, 2022
Add a plugin for configuring gqlgen via directives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v0.9.1 fixed in v0.9.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow for custom implementations of the @deprecated directive
4 participants