99designs / 99designs/gqlgen

Plugins: Access to current sources before `InjectSourceEarly`

未关闭
#2,603 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
10.8k
派生
1.3k
平均合并
2 天 36 分钟
30 天内合并 PR
26

描述

I've run into an issue while creating a plugin.

My plugin needs to inject sources, however, it has to dynamically figure out what is missing from the current sources. This is an issue since the `InjectSourceEarly` method does not provide access to either the config or the current sources.

One way would have been to read the config at an earlier point, but the `EarlySourceInjector` plugins are the first to run.

### Suggestion

Have a `ConfigCompleter` or `ConfigExtender` hook for plugins to be able to read the config **before** any generation starts. The `MutateConfig` hook runs too late. Or maybe split `ConfigMutator` into `EarlyConfigMutator` and `LateConfigMutator`

OR

Pass the existing sources to the `EarlySourceInjector` and `LateSourceInjector` plugins. Plugin that needs to change what is injected based on what is already present would appreciate this.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。