Skip to main content

Lint

Lint OMG files for style and correctness issues.

Usage​

omg lint <path>

Arguments​

ArgumentDescription
pathFile or directory to lint

Examples​

Lint a directory​

omg lint my-api/

Lint a single file​

omg lint my-api/endpoints/get-user.omg.md

Rules​

The linter checks for:

  • Missing required frontmatter fields
  • Invalid HTTP methods
  • Malformed code blocks
  • Type syntax errors
  • Unresolved partial references
  • Inconsistent naming conventions

Output​

my-api/endpoints/get-user.omg.md
3:1 error Missing operationId in frontmatter
15:1 warning Response schema should have description

my-api/endpoints/list-users.omg.md
8:1 error Unknown block type: omg.params

2 files checked, 2 errors, 1 warning

Exit codes​

CodeDescription
0No errors
1Errors found

Configuration​

Linting rules can be configured in .spectral-omg.yaml:

extends: [[spectral:oas, off]]
rules:
omg-operationId-required: error
omg-description-recommended: warn