Elements CLI
The missing CLI for beautiful, interactive API docs powered by with Stoplight Elements
Installation
Install using npm as global package:
npm install -g @skriptfabrik/elements-cliUsage
elements --helpElements CLI
Usage:
elements command [options] [arguments]
Options:
-h, --help Display this help message
-v, --version Print version number
Commands:
export Export rendered API docs
preview Preview rendered API docsExport
elements export --helpElements CLI
Usage:
elements export [options] <openapi_json>
Arguments:
openapi_json The path or URL of the OpenAPI JSON file
Options:
--base-path=BASE_PATH Use the given base path [default: "/"]
--credentials-policy=CREDENTIALS_POLICY Credentials policy for "Try It" feature: omit, include, same-origin [default: "omit"]
--cors-proxy=CORS_PROXY Provide CORS proxy-h, --help Display this help message --layout=LAYOUT Layout for Elements: sidebar, stacked [default: "sidebar"] --logo=LOGO URL of an image that will show as a small square logo next to the title -n --no-try-it Hide the "Try It" panel (the interactive API console) --router=ROUTER Determines how navigation should work: history, hash, memory, static [default: "history"] --style=STYLE Additional style for Elements [default: "flex: 1 0 0; overflow: hidden;"] --title=TITLE API docs title [default: "My API Docs"] --variable=VARIABLE Variable to be replaced in the OpenAPI document -v, --version Print version number
Examples: Export rendered API docs based on local openapi.json path as index.html:
elements export openapi.json index.html
Export rendered Swagger Petstore docs based on remote https://petstore.swagger.io/v2/swagger.json URL as index.html:
elements export --title="Swagger Petstore" https://petstore.swagger.io/v2/swagger.json index.html
### Preview
elements preview --help