Skip to main content

CLI Reference

lint

docker run --rm \
-v "$(pwd):/usr/src/app" \
-w /usr/src/app \
specmatic/enterprise \
lint [targets...] [options]

Specmatic Linter currently accepts OpenAPI documents in YAML or JSON. Targets may be individual files, multiple paths, or glob patterns.

OptionMeaningDefault
--config <path>Local config path; repo-relative path with --config-repo-urlAuto-discover local config or remote root config
--config-repo-url <url>Git repository containing central configNone
--profile <name>Profile to applySole profile or default
--format <json|html>Detailed report formatjson
--timePrint per-target and total durationOff
-h, --helpShow command helpNot applicable
-V, --versionShow versionNot applicable

Examples:

docker run --rm \
-v "$(pwd):/usr/src/app" \
-w /usr/src/app \
specmatic/enterprise \
lint openapi.yaml

docker run --rm \
-v "$(pwd):/usr/src/app" \
-w /usr/src/app \
specmatic/enterprise \
lint orders.yaml payments.yaml --profile public-api

docker run --rm \
-v "$(pwd):/usr/src/app" \
-w /usr/src/app \
specmatic/enterprise \
lint "specs/**/*.{yaml,yml,json}" --format=html --time

lint get-rules

get-rules describes rules for selected specification format. It currently generates OpenAPI rule catalog.

docker run --rm \
-v "$(pwd):/usr/src/app" \
-w /usr/src/app \
specmatic/enterprise \
lint get-rules [options]
OptionMeaningDefault
--config <path>Linter config pathParent command value or auto-discovery
--config-repo-url <url>Central config repositoryParent command value
--profile <name>Profile whose effective rules are listedParent command value or automatic selection
--format <html|json>Catalog formathtml
--timePrint catalog generation durationOff

OpenAPI catalog output:

<config-directory>/build/reports/specmatic/lint/openapi/rules-report.<format>

See OpenAPI Configuration Reference for rule configuration, assertions, node types, and report fields.