Use Rusl in your stack.
Once they're vendored, your schemas are plain JSON Schema files. Use the standard tooling for your language to generate code and validate payloads against them.
The CLI vendors your schemas into the repo at ./schemas/<account>/schemas/<schema>.json by default. Set schema_dir in rusl.config.toml to change it.
Generate your code
Generated types save you hand-writing structs. As one example, quicktype turns a JSON Schema into types in your language — it isn't the only tool, but it covers most of them. quicktype reads a single input, so bundle the root schema first, then generate. quicktype.io
bun add -d @skriptfabrik/json-schema-bundler quicktypebunx @skriptfabrik/json-schema-bundler --silent \
./schemas/rusl/schemas/context-request.json |
bunx quicktype \
--src-lang schema \
--lang typescript \
--top-level ContextRequest \
--out src/contracts/rusl/context-request.tsimport { Convert } from "./contracts/rusl/context-request";
const request = Convert.toContextRequest(incomingJson);Validate payloads
Validate real payloads against the schema with a standard JSON Schema validator. Good choices by language:
Best default for exact JSON Schema validation in JS runtimes.
bun add ajv ajv-formatsModern draft support and a clean compiler API for local schema files.
go get github.com/santhosh-tekuri/jsonschema/v6Use Pydantic for app models. Use jsonschema when the raw contract is the validator.
uv add pydantic "jsonschema[format-nongpl]"Validates runtime values against draft 2020-12 JSON Schemas.
cargo add serde_json jsonschemaThe usual JVM choice for validating payloads against JSON Schema.
implementation "com.networknt:json-schema-validator:3.0.2"Good fit when .NET code needs to stay close to JSON Schema semantics.
dotnet add package Corvus.Text.Json.ValidatorCompile the installed schema and validate external payloads before mapping into domain structs.
{:ex_jsonschema, "~> 0.2.0"}With versioned schemas in your repository, derive everything from them.
The schema is the source. Generate code and validators from it, and regenerate when a new version lands.
Install the CLI