Skip to content

Commit 163886f

Browse files
mpywclaude
andcommitted
docs: simplify global_helpers and add _file variants to array sources
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent abe5693 commit 163886f

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,12 @@ transform:
184184
Reusable JavaScript functions for all transforms:
185185

186186
```yaml
187-
global_helpers:
188-
js: |
189-
function requireInt(val, name) {
190-
const n = parseInt(val);
191-
if (isNaN(n)) throw { status: 400, body: { error: name + ' required' } };
192-
return n;
193-
}
187+
global_helpers: |
188+
function requireInt(val, name) {
189+
const n = parseInt(val);
190+
if (isNaN(n)) throw { status: 400, body: { error: name + ' required' } };
191+
return n;
192+
}
194193
195194
queries:
196195
- type: one
@@ -232,15 +231,21 @@ mock:
232231
- { id: 2, name: Bob }
233232
# or
234233
array_json: '[{"id": 1}, {"id": 2}]' # JSON string
234+
array_json_file: ./data/users.json # External JSON file
235235
# or
236236
csv: | # CSV with header
237237
id,name
238238
1,Alice
239239
2,Bob
240+
csv_file: ./data/users.csv # External CSV file
240241
# or
241242
jsonl: | # JSON Lines
242243
{"id": 1, "name": "Alice"}
243244
{"id": 2, "name": "Bob"}
245+
jsonl_file: ./data/users.jsonl # External JSONL file
246+
# or
247+
array_js: | # JavaScript (dynamic)
248+
return [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }];
244249
```
245250

246251
### Array Sources with Filter (for `type: one`)

0 commit comments

Comments
 (0)