Your first automation task
Use Zy to check a JSON configuration and get a clear success or failure result. This walkthrough uses synthetic repository fixtures and runs locally.
Run a complete validator
Build from the repository root with Go 1.22 or later:
go build -o bin/zy .
./bin/zy examples/workflows/config-validator.zy examples/workflows/fixtures/config-valid.json
On Windows, build with go build -o bin/zy.exe ., then use ./bin/zy.exe in place of ./bin/zy. A matching binary archive can run the same examples without Go.
The valid fixture prints PASS: service configuration satisfies all rules. and exits 0. Replace config-valid.json with config-invalid.json to see four failures and exit 1. Each report line identifies the JSON field, rule, and suggested correction. For example, /replicas [replica-bounds] asks for an integer from 1 through 100.
Copy the invalid JSON into a scratch directory and fix its region, port, replicas, and service address using the messages. Run the validator again against your copy. Do not edit the regression fixtures. Add --json after the input filename when another program needs to consume the result; stdout contains the report and stderr contains the failure summary.
Write a small rule
Save this as validate.zy:
let config = json.decode("{\"enabled\":true,\"retries\":3}")
assert(config.enabled, "Enable this automation before running it.")
assert(config.retries >= 0 and config.retries <= 5, "Set retries between 0 and 5.")
print(json.encode({ok: true, retries: config.retries}))
Run it with ./bin/zy validate.zy. To read a file instead of the embedded JSON, replace the first line with let config = json.load(args()[0]) and pass a JSON filename after validate.zy. File inputs are limited to 1 MiB. Field access on a missing key returns null; check shape/type before performing comparisons on untrusted data.
Work comfortably in the editor
Use the VS Code setup to enable local diagnostics, completion, hover, and Go to Definition. Start with json. to discover JSON operations. Format Document normalizes your script. Toggle Word Wrap (Alt+Z) displays long calls without changing code. Extract shared rules into a local module when several scripts need them.
Zy remains experimental. Syntax checking does not evaluate assertions or prove data validity; run the script to check its policy. See limits before choosing it for an operational task.