Validation Connector
Overview
Section titled “Overview”The Validation connector checks each payload against a list of field rules. When a rule fails, the configured onInvalid policy decides whether to drop the payload, forward it as-is, or tag it with a validity flag.
Connector Type: MeddleValidation
Configuration
Section titled “Configuration”{ "type": "MeddleValidation", "config": { "onInvalid": "drop", "rules": [ { "key": "temperature", "type": "number", "required": true, "min": -40, "max": 150 }, { "key": "sensor_id", "type": "string", "required": true, "pattern": "^S-[0-9]{4}$" }, { "key": "active", "type": "boolean", "required": false } ] }}Configuration Parameters
Section titled “Configuration Parameters”- rules (required, min 1): List of per-field rules
- onInvalid (required): Behaviour when at least one rule fails —
drop,forward, ortag - invalidTag: Key written to the payload under
tagmode (default_valid)
Rule Fields
Section titled “Rule Fields”- key (required): Payload field name to check
- type (required):
string,number, orboolean - required: When
true, an absent field fails the rule. Whenfalse, an absent field skips the rule. - min, max: Inclusive numeric range (only valid for
type: number) - pattern: Regular expression (only valid for
type: string)
Type Checks
Section titled “Type Checks”- number — Accepts any numeric value coercible to
float64(int, float, etc.). Type mismatch is reported as an error. - string — Accepts Go
string. Ifpatternis set, the value must match. - boolean — Accepts Go
bool.
Range and Pattern
Section titled “Range and Pattern”min / max are inclusive. A temperature of exactly -40 passes min: -40. Regex patterns are compiled once at startup with Go’s RE2 syntax; invalid patterns prevent the connector from starting.
On Invalid Policies
Section titled “On Invalid Policies”Drop Mode
Section titled “Drop Mode”{ "onInvalid": "drop" }Failing payloads are silently discarded (errors still appear on the error channel). Only valid payloads are forwarded.
Forward Mode
Section titled “Forward Mode”{ "onInvalid": "forward" }Every payload is forwarded regardless of validity. Use this for monitoring only.
Tag Mode
Section titled “Tag Mode”{ "onInvalid": "tag", "invalidTag": "is_valid"}Invalid payloads are forwarded with the tag key set to false. Valid payloads pass through unchanged. If invalidTag is omitted, the key defaults to _valid.
Use Cases
Section titled “Use Cases”- Reject malformed sensor readings before they reach storage
- Enforce ID conventions with regex patterns (e.g. asset tags)
- Range gating for physical sensors with known operating envelopes
- Soft validation with
tagmode for downstream Router-based handling
Example: Strict Drop
Section titled “Example: Strict Drop”{ "type": "MeddleValidation", "config": { "onInvalid": "drop", "rules": [ { "key": "device_id", "type": "string", "required": true, "pattern": "^DEV-[A-Z0-9]+$" }, { "key": "temperature", "type": "number", "required": true, "min": -20, "max": 120 }, { "key": "online", "type": "boolean", "required": true } ] }}Any payload missing a field, failing the regex, or with temperature outside [-20, 120] is dropped.
Example: Tag and Route
Section titled “Example: Tag and Route”{ "type": "MeddleValidation", "config": { "onInvalid": "tag", "invalidTag": "is_valid", "rules": [ { "key": "pressure", "type": "number", "required": true, "min": 0, "max": 200 } ] }}Combine with a downstream Router that branches on is_valid to send clean and dirty payloads to different sinks.
Best Practices
Section titled “Best Practices”- Use
dropfor hard schemas at the boundary of trusted/untrusted data - Use
tag+ Router when you want to inspect or quarantine invalid payloads rather than lose them - Keep regex patterns anchored (
^...$) to avoid accidental partial matches - Set tight numeric ranges based on physical/operational limits — this catches sensor faults early
- Place Validation near the start of pipelines so downstream connectors can assume well-formed payloads