Skip to main content

Build

Compile OMG files to OpenAPI 3.1 specification.

Usage​

omg build <input> [options]

Arguments​

ArgumentDescription
inputPath to root .omg.md file

Options​

OptionDescriptionDefault
-o, --output <file>Output file pathstdout
-f, --format <fmt>Output format: yaml or jsonyaml

Examples​

Build to YAML​

omg build api.omg.md -o openapi.yaml

Build to JSON​

omg build api.omg.md -o openapi.json -f json

Output to stdout​

omg build api.omg.md

Validate output​

omg build api.omg.md -o openapi.yaml
npx @apidevtools/swagger-cli validate openapi.yaml

Input file structure​

The build command expects a root OMG file that may include other files:

---
title: My API
version: 1.0.0
---

# My API

API description here.

\{\{> endpoints/users \}\}
\{\{> endpoints/accounts \}\}

All referenced partials and endpoints are resolved and compiled into a single OpenAPI document.