Comments (5)
Hey @cludden, I'm open to it but would be worried about the rate at which the config spec might grow as we add more operators. As an alternative suggestion, what if we changed the type of arg
to be an interface{}
?
Also for the example of adding a json_schema
operator to jmespath
I think it might be more generally useful to have something similar to the process_field
processor for conditions, maybe called something like check_field
, where the config might look something like this:
condition:
type: check_field
check_field:
path: foo
conditions:
- type: json_schema
json_schema:
type: object
... etc ...
That way we could recycle it for doing things like text
conditions on a JSON field.
from connect.
that seems reasonable. I think my only concern with the interface{}
approach is the lack of built in documentation for operator configuration and the addition of a lot of type coercion / reflection in each of the operator factories which may clutter the code base unnecessarily. are you imaging something like the json
processor's value
field?
and the json_schema
operator was a made up example. at the moment I really only need enum support for both metadata and json payloads, and was hoping to avoid building gigantic configurations by combining an or
condition with a long list of subconditions. I do however really like the idea of a check_field
condition. Also, what are your thoughts on adding operator
support to the jmespath
condition? currently it acts as a bool
operator (foo == 'bar'
), but I think it could be useful to allow some other common operators (regexp_partial
, regexp_exact
, less_than
, greater_than
, enum
)
from connect.
Sorry if I posted this already elsewhere, I thought I did but can't seem to find it. Anyways, I started looking at this and it's unclear to me how a check_field
condition would pass the extracted json values to child conditions. Currently conditions expect to receive a types.Message
as opposed to something like []byte
. The only way I can currently think to implement this without a significant refactor would be to wrap the extracted bytes as a new message and pass this to child conditions, which seems kind of hacky. I could be missing something obvious, but It seems more straight forward to me to either a) expand the jmespath
condition or b) add a new json_field
condition.
Either of these could be built/refactored to support a list of operators (and in the case of the jmespath condition, refactor the existing implementation to act as a bool
operator). These could then implement many of the common operators shared by the text
and metadata
conditions but could expand to include additional json specific operators like json_schema
.
from connect.
I imagine it could work similar to process_field
: https://github.com/Jeffail/benthos/blob/master/lib/processor/process_field.go#L149. I can do it when I get a chance, made a new issue for it: #88
from connect.
Closing this, lets continue any further conversation in #88
from connect.
Related Issues (20)
- Add Splunk_hec label to metrics output HOT 1
- output component fallback not work HOT 1
- [Feature Request] Trim whitespaces from columns in CSV scanner/input HOT 1
- aws_s3: Scanner and backing reader not closed on non `io.EOF` error
- 4.28.0 should really be 5.0.0 HOT 3
- Document change in licensing HOT 2
- Inconsistent behavior with Javascript processing HOT 1
- JavaScript processor unable to handle asynchronous code execution HOT 1
- Iceberg support HOT 1
- Esto serΓ‘ facil
- MwM
- Exclude enterprise licensed plugins from the all package HOT 2
- main.go seems to be Redpanda Enterprise licensed HOT 2
- Document workflow/result_map
- CLI references the wrong binary name
- Collaborate on a Benthos processor for a Conduit pipeline?
- Dependency Licensing issue caused by couchbase/gocbcoreps HOT 3
- aws_kinesis input: shards are not processed if they are closed HOT 4
- public free bundle missing the xml package import HOT 2
- Pass along bloblang/yaml error context
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect.