@cdmx/n8n-nodes-schema-validator 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -2
- package/dist/nodes/SchemaValidator/SchemaValidator.node.js +7699 -483
- package/dist/nodes/SchemaValidator/SchemaValidator.node.js.map +7 -1
- package/dist/nodes/SchemaValidator/lib/dataExtractor.js +74 -48
- package/dist/nodes/SchemaValidator/lib/dataExtractor.js.map +7 -1
- package/dist/nodes/SchemaValidator/lib/index.js +7270 -18
- package/dist/nodes/SchemaValidator/lib/index.js.map +7 -1
- package/dist/nodes/SchemaValidator/lib/schemaParser.js +49 -24
- package/dist/nodes/SchemaValidator/lib/schemaParser.js.map +7 -1
- package/dist/nodes/SchemaValidator/lib/validator.d.ts +2 -2
- package/dist/nodes/SchemaValidator/lib/validator.js +7163 -82
- package/dist/nodes/SchemaValidator/lib/validator.js.map +7 -1
- package/dist/nodes/SchemaValidator/types.js +18 -2
- package/dist/nodes/SchemaValidator/types.js.map +7 -1
- package/package.json +6 -8
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ Advanced JSON Schema validation node for [n8n](https://n8n.io/) workflows. Valid
|
|
|
12
12
|
- 💬 **Custom Error Messages** - Define custom error messages in your schemas via [ajv-errors](https://github.com/ajv-validator/ajv-errors)
|
|
13
13
|
- 🔀 **Dual Output** - Valid items go to one output, invalid items go to another
|
|
14
14
|
- 🎯 **Data Path Extraction** - Validate specific parts of your data using JSON paths
|
|
15
|
+
- 📋 **Automatic Array Handling** - Automatically detects and validates arrays of objects
|
|
16
|
+
- 🎯 **Single Output Mode** - Combine valid and invalid items into one output with status
|
|
15
17
|
- ⚙️ **Configurable Options** - Control strict mode, all errors collection, and more
|
|
16
18
|
|
|
17
19
|
## Installation
|
|
@@ -108,15 +110,64 @@ Use ajv-errors syntax to define custom messages:
|
|
|
108
110
|
}
|
|
109
111
|
```
|
|
110
112
|
|
|
113
|
+
### Automatic Array Handling
|
|
114
|
+
|
|
115
|
+
NEW! The validator automatically detects when your data is an array and validates each object individually. No configuration needed!
|
|
116
|
+
|
|
117
|
+
**Example Input:**
|
|
118
|
+
```json
|
|
119
|
+
[
|
|
120
|
+
{ "id": 1, "name": "Alice", "email": "alice@example.com" },
|
|
121
|
+
{ "id": 2, "name": "Bob", "email": "invalid-email" },
|
|
122
|
+
{ "id": 3, "name": "Charlie", "email": "charlie@example.com" }
|
|
123
|
+
]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Configuration:**
|
|
127
|
+
- **Data Source**: `Input Data` or `Custom JSON`
|
|
128
|
+
- **Schema**: User object schema (for individual objects, not the array)
|
|
129
|
+
|
|
130
|
+
**Result**: Each user object is validated individually, creating separate output items for valid/invalid users automatically.
|
|
131
|
+
|
|
132
|
+
### Single Output Mode
|
|
133
|
+
|
|
134
|
+
NEW! Instead of separating valid/invalid items into two outputs, combine them into one output with validation status.
|
|
135
|
+
|
|
136
|
+
**Enable in Options:**
|
|
137
|
+
- **Single Output**: `true`
|
|
138
|
+
|
|
139
|
+
**Output includes:**
|
|
140
|
+
- `validationStatus`: `"valid"` or `"invalid"`
|
|
141
|
+
- All original data
|
|
142
|
+
- Error details (if invalid)
|
|
143
|
+
|
|
144
|
+
**Example Output:**
|
|
145
|
+
```json
|
|
146
|
+
[
|
|
147
|
+
{ "name": "Alice", "validationStatus": "valid" },
|
|
148
|
+
{
|
|
149
|
+
"name": "Bob",
|
|
150
|
+
"validationStatus": "invalid",
|
|
151
|
+
"validationErrors": [...],
|
|
152
|
+
"validationMessage": "..."
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
```
|
|
156
|
+
|
|
111
157
|
## Output
|
|
112
158
|
|
|
159
|
+
### Default Mode (Dual Output)
|
|
113
160
|
### Valid Items (Output 1)
|
|
114
161
|
Items that pass validation are output unchanged.
|
|
115
162
|
|
|
116
163
|
### Invalid Items (Output 2)
|
|
117
164
|
Items that fail validation include:
|
|
118
|
-
- `
|
|
119
|
-
- `
|
|
165
|
+
- `validationMessage`: Human-readable error summary
|
|
166
|
+
- `validationErrors` (single mode) or `validationResults` (multiple mode): Detailed error information
|
|
167
|
+
|
|
168
|
+
### Single Output Mode
|
|
169
|
+
When enabled, all items go to Output 1 with additional field:
|
|
170
|
+
- `validationStatus`: `"valid"` or `"invalid"`
|
|
120
171
|
|
|
121
172
|
## Options
|
|
122
173
|
|
|
@@ -127,6 +178,8 @@ Items that fail validation include:
|
|
|
127
178
|
| Strict Mode | `true` | Enable strict schema validation |
|
|
128
179
|
| All Errors | `true` | Collect all errors vs. stop at first |
|
|
129
180
|
| Include Error Details | `true` | Include detailed errors in output |
|
|
181
|
+
| Include Original Data | `false` | Include original input data in output |
|
|
182
|
+
| Single Output | `false` | Combine valid/invalid items into one output |
|
|
130
183
|
|
|
131
184
|
## Development
|
|
132
185
|
|