Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

orion-server fmt

Formats definition files to the house style, the way cargo fmt formats Rust. One style, nothing to configure; the style itself is documented on Definition Style. Needs no config, database, or server.

Synopsis

orion-server fmt [PATH]... [--check] [--stdin]

Description

Files are rewritten atomically: a sibling temp file is renamed over the original, permissions preserved. The write happens only after the formatted output has been parsed again and compared with the input as the runtime sees it. A formatter that could change what a workflow means would not be safe to run from a pre-commit hook. A file that is not strict JSON, has a duplicate key, or nests too deep for the parser is reported with its line and column. It is left untouched.

Options

FlagDescription
PATHFiles or directories (default: .). Every .json under a directory is formatted — entities, shared documents, *.case.json files and fixtures alike. Hidden entries, target/ and node_modules/ are skipped; symlinked directories are not followed.
--checkWrite nothing. Print a unified diff for every file that is not in the house style and exit 1 if there is one — the CI form.
--stdinFormat one document from stdin to stdout, for editor integration. On a parse error nothing reaches stdout.

Returns

Exit codeMeaning
0Every file is formatted, or has been written by this run.
1--check found at least one file it would rewrite.
2A file could not be read, parsed or written. The other files are still processed.

Examples

$ orion-server fmt --check ./definitions
--- a/definitions/orders/channel.json
+++ b/definitions/orders/channel.json
@@ -3,9 +3,7 @@
   "name": "orders",
   "channel_type": "sync",
   "protocol": "rest",
-  "methods": [
-    "POST"
-  ],
+  "methods": ["POST"],
   "route_pattern": "/orders",
1 file(s) would be reformatted, 61 unchanged
orion-server fmt ./definitions && orion-server lint ./definitions

Last verified 14 September 2026