Skip to main content

Init

Initialize a new OMG project with example files.

Usage

omg init <directory>

Arguments

ArgumentDescription
directoryDirectory name for the new project

Examples

Create a new project

omg init my-api

Initialize in current directory

omg init .

Generated structure

my-api/
├── api.omg.md # Root API definition
├── endpoints/
│ └── health.omg.md # Example health endpoint
└── partials/
└── errors.omg.md # Shared error definitions

api.omg.md

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

# My API

API description.

\{\{> endpoints/health \}\}

endpoints/health.omg.md

---
method: GET
path: /health
operationId: health-check
tags: [System]
---

# Health Check

Returns the health status of the API.

```omg.response
{
status: "healthy" | "degraded" | "unhealthy",
timestamp: datetime
}

{{> partials/errors }}


## Next steps

After initializing:

```bash
cd my-api
omg build api.omg.md -o openapi.yaml