Smithy IDL 2.0 for MoonBit
Smithy models, validated.
No JVM.
Parse, validate and build Smithy models in pure MoonBit. Then check real API traffic against them: JSON values, JSON-RPC messages and whole transcripts.
order.smithy$version: "2"
namespace example
structure Order {
@required
id: String
@range(min: 1)
quantity: Integer
}
terminal$ echo '{"id": "A-17", "quantity": 0}' > order.json
$ smithy validate value --shape example#Order --value order.json order.smithy
order.json/quantity: error[Range] example#Order$quantity: I expected the number to satisfy the modeled range.Two ways in
Pick the job you came for
Work with Smithy models in MoonBit
For MoonBit developers who want Smithy without a Java toolchain.
- Parse and assemble IDL and JSON AST, with lossless CST and recovery
- Validate models with the Smithy rules, selectors and contracts
- Build projections and plugins: JSON Schema, OpenAPI 3.0/3.1, OpenRPC
- Diff two model snapshots for breaking changes
Validate API requests and responses
For teams who want to check real traffic against the contract.
- Values: application JSON or Ion against any data shape, with exact numbers
- JSON-RPC 1.0 / 2.0: requests, notifications, replies and batches
- Transcripts: two-peer exchanges and JSONL logs, findings as they stream
- Conformance suites for MCP, LSP and your own protocols
Why smithy.mbt
One toolchain, every target
No JVM
Pure MoonBit. Ship a static native binary, a wasm module or a js bundle.
Reference-checked
The parser and loader run against the vendored Java reference test corpus.
Findings you can act on
First-person messages with exact paths, shape IDs and stable codes. Text or JSON.
Streams
JSONL logs from stderr or files give findings line by line, before the input ends.
Library first
Every CLI command is a library API you can call from your own MoonBit code.
Runs in the browser
The playground runs the same packages client-side. Nothing goes to a server.
Install
Get the CLI or the library
# Native binary for Linux, macOS or Windows
mise use -g github:moonrockz/smithy
smithy versionPlayground
Try it without installing
Paste a model and see diagnostics as you type. Convert it, query it, or step through a JSON-RPC transcript against it.
Open the playground →Examples