Configuration
Specmatic Linter reads policy from specmatic-linter.yaml or specmatic-linter.yml in the current directory. Use --config path/to/file.yaml when the file lives elsewhere.
A configuration contains:
rules: optional custom-rule inventory;profiles: named policies that select and tune rules.
At least one profile is required.
Practical example
specmatic-linter.yaml
rules:
company/parameter-description:
severity: error
type: parameters
message: Every parameter must have a description.
on:
type: Parameter
must:
required:
- description
profiles:
default:
rules:
extends:
- recommended
include:
- company/parameter-description
exclude:
- info-license
override:
operation-summary: warn
This profile:
- starts with
recommendedbuilt-in rules; - enables the custom parameter rule;
- disables
info-license; and - changes
operation-summaryto a warning.
Select rule categories
Limit a profile to one or more rule categories with types:
profiles:
security-review:
types:
- security
- schema
rules:
extends:
- recommended
Available categories: metadata, parameters, operations, security, schema, and examples. Omit types to run every selected category.
Set severity
profiles:
default:
rules:
extends:
- recommended
override:
operation-summary: warn
info-contact: off
no-unresolved-refs: error
| Value | Reported | Fails command |
|---|---|---|
error | Yes | Yes |
warn | Yes | No |
off | No | No |
on and true are aliases for error; false is an alias for off. Prefer explicit values for readability.
Selection order
Effective rules build in this order:
- rules from
rules.extends; - rules named in
rules.include; - rules removed by
rules.exclude; - settings from
rules.override.
Use override to tune a built-in rule. Do not redeclare built-in rule IDs under top-level rules.
See Built-in Rules, Custom Rules, Profiles, and Configuration Reference for details.