Parse
Parse an OMG file and output its AST (Abstract Syntax Tree).
Usage
omg parse <file>
Arguments
| Argument | Description |
|---|---|
file | Path to .omg.md file to parse |
Examples
Parse a single endpoint
omg parse endpoints/get-user.omg.md
View parsed structure
omg parse api.omg.md | jq .
Output
The command outputs a JSON representation of the parsed AST:
{
"frontmatter": {
"method": "GET",
"path": "/users/{userId}",
"operationId": "get-user",
"tags": ["Users"]
},
"title": "Get User",
"description": "Returns a user by ID.",
"blocks": [
{
"type": "path",
"schema": {
"type": "object",
"properties": {
"userId": {
"type": "primitive",
"value": "uuid"
}
}
}
}
]
}
Use cases
- Debugging — Verify how your OMG is being parsed
- Tooling — Build custom tools that consume OMG AST
- Validation — Check syntax before building