99designs / 99designs/gqlgen

Plugins: Access to current sources before `InjectSourceEarly`

Open
#2,603 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.8k
Forks
1.3k
Avg merge
2d 36m
Merged PRs (30d)
26

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.