Smithy command-line application
moonx moonrockz/smithy-cli@latest --help
moonx moonrockz/smithy-cli@latest versionmise use -g github:moonrockz/smithy
smithy versionmoon build apps/smithy --target native --release
_build/native/release/build/moonrockz/smithy-cli/smithy-cli.exe versionsmithy ast model.smithy extra.json
smithy validate model.smithy extra.json
smithy validate-value --shape example#Input --value request.json model.smithy
smithy diff --old previous/ --new current/
smithy build --config smithy-build.json
smithy clean --config smithy-build.json
smithy select --selector 'structure > member > string' model.smithy
smithy convert --to json model.smithy -o model.json
smithy convert --to idl model.json -o model.smithy
smithy convert --to idl one.json two.json --output-dir generated
smithy format model.smithy
smithy format --check model.smithy model.json
smithy format --write model.smithy model.jsonsmithy diff --old previous/ --new current/ --format jsonl
smithy diff --old previous/ --new current/ --format=jsonl --output changes.jsonl{"id":"ChangedMemberTarget","severity":"ERROR","shape":"example#Value$name","message":"The event message","source":{"file":"current/model.smithy","path":"","span":{"start":42,"length":12}}}| Field | Value |
|---|---|
| id | Event identifier string |
| severity | NOTE, WARNING, DANGER or ERROR |
| shape | Absolute shape ID string, or null for a model-level event |
| message | Complete message string; JSON decoding restores newlines and other escaped characters |
| source | null, or an object containing file, path and span |
| source.file | Physical source identifier, including archive entry paths when present |
| source.path | JSON Pointer for JSON AST input, otherwise usually an empty string |
| source.span | null, or nonnegative integer start and length in zero-based UTF-16 code units |
set -o pipefail
smithy diff --old previous/ --new current/ --format jsonl |
jq --unbuffered -c 'select(.severity == "ERROR" or .severity == "DANGER")'mise exec -- moon run apps/smithy --target js -- build --config examples/local-resources/smithy-build.jsoncat model.smithy | smithy convert --from idl --to json -{"path":"module.zip","root":"models","paths":["service.smithy"],"globs":["shared/**/*.json"]}{"path":"downloaded-package.tgz","root":"package/models","globs":["**/*.smithy","**/*.json"]}mise exec -- moon run apps/smithy --target js -- build --config examples/npm-archive/smithy-build.json{"url":"https://example.org/models.zip","format":"zip","root":"models","globs":["**/*.smithy"]}mise exec -- moon run apps/smithy --target js -- build --config examples/public-archive/smithy-build.json$version: "2"
namespace example
@range(min: 1, max: 100)
integer Count
structure Input {
@required
count: Count
}smithy validate-value --shape example#Input --value request.json model.smithy
smithy validate-value --shape example#Input --value request.json --diagnostics json model.smithy{
"version": "2.0",
"sources": [{
"github": {
"repository": "owner/models",
"tag": "v1.2.3",
"asset": "models.zip"
},
"format": "zip",
"root": "models",
"globs": ["**/*.smithy"]
}]
}{
"version": "2.0",
"sources": [{
"npm": { "package": "@scope/models", "version": "1.2.3" },
"root": "package/models",
"globs": ["**/*.smithy"]
}],
"imports": [{
"maven": {
"group": "org.example",
"artifact": "model-traits",
"version": "1.2.3"
}
}]
}mise exec -- moon run apps/smithy --target js -- build --config examples/npm-registry/smithy-build.json
mise exec -- moon run apps/smithy --target js -- build --config examples/maven-repository/smithy-build.json{
"version": "2.0",
"credentials": [
{ "origin": "https://api.github.com", "bearerTokenEnv": "GITHUB_TOKEN" },
{ "origin": "https://registry.npmjs.org", "bearerTokenEnv": "NPM_TOKEN" },
{ "origin": "https://maven.example.com", "usernameEnv": "MAVEN_USER", "passwordEnv": "MAVEN_PASSWORD" }
]
}type Layouttype OutputSink