Closed Kelvin4664 closed 3 years ago
@Kelvin4664 I like that idea. It would be nice if multiple plugins could be used at once. 👍
What merge style would you expect? Like, having a key for each plugin?
What merge style would you expect? Like, having a key for each plugin?
I imagine we'd want to be able to register multiple plugins, and then the generated payloads for each plugin should be merged with each other to generate the final payload. Here's an example of what I'd personally expect:
plugin 1:
{
"request": {
"context": {
"foo": "foo value"
}
}
}
plugin 2:
{
"request": {
"context": {
"bar": "bar value"
}
}
}
result:
{
"request": {
"context": {
"foo": "foo value",
"bar": "bar value"
}
}
}
Our payload schema provides an example of what properties should be supported. I wouldn't want to merge objects in user-provided values; for instance:
plugin 1:
{
"request": {
"context": {
"myObject": {
"foo": "foo value"
}
}
}
}
plugin 2:
{
"request": {
"context": {
"myObject": {
"bar": "bar value"
}
}
}
}
result:
{
"request": {
"context": {
"myObject": {
"bar": "bar value"
}
}
}
}
We may want a way to register plugins in order (so that we can determine the merge priority), although it could just be the order in which the plugins were registered.
@Kelvin4664 what do you think?
Apologies.. I didn't catchup with this conversation on time. Already did something in #81
There's a possible scenario where we have more than one plugin registered at a time. E.g: I have a django/flask application deployed to AWS Lambda. This makes it possible to have the lambda plugin auto registered & possibly the flask/django plugin (if used on the application.) Current behaviour is to return payload from the first registered plugin. Proposed behaviour is to pass the payload through all registered plugins before returning. @joshuap any thoughts?