CODESEEDSign in
Explore projects
Gobeginnercli

JSON Config Validator CLI

CLI tool in Go that validates JSON/YAML files against a JSON Schema, with clear errors and a non-zero exit code on failure.

5 steps

Project steps

  1. 01

    CLI with Cobra

    Command: validate --schema schema.json config.yaml

  2. 02

    YAML → JSON

    If the file is YAML, convert it to JSON before validation.

  3. 03

    JSON Schema Validation

    Use gojsonschema for validation and collect all errors.

  4. 04

    Formatted Output

    Errors with exact path ($.server.port), message, and error type.

  5. 05

    Exit codes

    0 = valid, 1 = invalid, 2 = read/parse error.

Recommended resources

Ready to build this?

Fork the repo on GitHub and start building. A mentor will review your code when you open a PR.

5 steps

Tech stack

Gocobragojsonschemagopkg.in/yaml.v3