Open dlvenable opened 1 month ago
@dlvenable I have a slightly different proposal which makes implementation easier without intrusive change in data-prepper-core:
We will keep the original
@JsonProperty("action")
@NotNull
@UsesDataPrepperPlugin(pluginType = AggregateAction.class)
private PluginModel aggregateAction;
Then we will register a custom deserializer and schema generator for PluginModel.class.
Is your feature request related to a problem? Please describe.
Data Prepper plugins can depend on other Data Prepper plugins. They load these plugins manually using the
PluginModel
.This results in duplicated logic such as the following:
https://github.com/opensearch-project/data-prepper/blob/91b6666512805bf502186bd683ae800b0943ba10/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessor.java#L83-L87
More importantly, it is also not compatible with our new support for schema and documentation generation.
Describe the solution you'd like
Provide a feature in Data Prepper core for loading plugins on behalf of other plugins. Data Prepper can have a new
@UsesDataPrepperPlugin
annotation which states that the type is a Data Prepper plugin.In plugin configurations, use the desired plugin interface type. For example, replace
https://github.com/opensearch-project/data-prepper/blob/91b6666512805bf502186bd683ae800b0943ba10/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessorConfig.java#L31-L34
with:
When loading plugins in Data Prepper core, detect this annotation and load the plugin.