Skip to content

Commit 5f6ae9a

Browse files
add arazzo2openapi tool (#701)
Co-authored-by: Mike Bifulco <mike@apisyouwonthate.com>
1 parent d49ac9c commit 5f6ae9a

1 file changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
name: arazzo2openapi
3+
description: |
4+
Convert Arazzo workflow documents into OpenAPI documents.
5+
Supports CLI and programmatic usage, with intelligent type inference
6+
from referenced OpenAPI source descriptions.
7+
categories:
8+
- converters
9+
- text-editors-extensions
10+
- cli
11+
link: https://frankkilcommins.github.io/arazzo2openapi
12+
languages:
13+
typescript: true
14+
javascript: true
15+
repo: https://github.com/frankkilcommins/arazzo2openapi
16+
oaiSpecs:
17+
oas: true
18+
overlays: false
19+
arazzo: true
20+
oasVersions:
21+
v2: false
22+
v3: true
23+
v3_1: true
24+
v3_2: false
25+
badges:
26+
- arazzo-support
27+
---
28+
29+
## Overview
30+
31+
`arazzo2openapi` converts Arazzo workflow descriptions into OpenAPI documents. It intelligently infers types, formats, and constraints from the referenced source OpenAPI documents — preserving descriptions, enums, and nested structures rather than generating bare schemas.
32+
33+
Available as a CLI tool and a programmatic TypeScript/JavaScript API. Try it online at [frankkilcommins.github.io/arazzo2openapi](https://frankkilcommins.github.io/arazzo2openapi).
34+
35+
## Installation
36+
37+
```bash
38+
npm install -g arazzo2openapi
39+
```
40+
41+
## CLI Usage
42+
43+
```bash
44+
# Convert a local file
45+
arazzo2openapi workflow.yaml -o openapi.yaml
46+
47+
# Convert from a remote URL
48+
arazzo2openapi https://example.com/workflow.yaml -o openapi.yaml
49+
50+
# Override metadata
51+
arazzo2openapi workflow.yaml \
52+
--title "My API" \
53+
--version "2.0.0" \
54+
--openapi-version 3.1.0
55+
```
56+
57+
**CLI options:**
58+
59+
| Option | Description |
60+
| ------------------------------ | ----------------------------------- |
61+
| `-o, --output <file>` | Output file path |
62+
| `-f, --format <format>` | Output format: `json` or `yaml` |
63+
| `--openapi-version <version>` | OpenAPI version: `3.0.0` or `3.1.0` |
64+
| `--title <title>` | Override API title |
65+
| `--version-override <version>` | Override API version |
66+
| `--description <description>` | Override API description |
67+
| `--server <url>` | Add server URL (repeatable) |
68+
| `--response-code <code>` | HTTP response code (default: `200`) |
69+
70+
## Programmatic API
71+
72+
```typescript
73+
import {
74+
ArazzoParser,
75+
OpenAPIGenerator,
76+
WorkflowAnalyzer,
77+
} from 'arazzo2openapi';
78+
79+
// Parse Arazzo document
80+
const parser = new ArazzoParser();
81+
const { document } = await parser.loadDocument('workflow.yaml');
82+
83+
// Analyze workflows
84+
const analyzer = new WorkflowAnalyzer();
85+
const workflows = analyzer.analyzeAllWorkflows(document);
86+
87+
// Generate OpenAPI
88+
const generator = new OpenAPIGenerator();
89+
const openapi = await generator.generateOpenAPI(
90+
document,
91+
workflows,
92+
'workflow.yaml',
93+
{
94+
arazzoPath: 'workflow.yaml',
95+
outputPath: 'openapi.yaml',
96+
openapiVersion: '3.1.0',
97+
}
98+
);
99+
```
100+
101+
## Type Inference
102+
103+
Types and formats are inferred from the source OpenAPI documents referenced in the Arazzo workflow — not guessed:
104+
105+
```yaml
106+
# Input: Arazzo workflow output references
107+
outputs:
108+
petId: $steps.getPet.outputs.id
109+
petName: $steps.getPet.outputs.name
110+
111+
# Output: OpenAPI with inferred types
112+
schema:
113+
properties:
114+
petId:
115+
type: integer # inferred from source
116+
format: int64
117+
petName:
118+
type: string # inferred from source
119+
```
120+
121+
Supports: primitive types, formats (uuid, email, date-time, int32, int64, float, etc.), enums, constraints (min/max, pattern), nested objects and arrays, and `$ref` resolution.
122+
123+
## Supported Versions
124+
125+
| Spec | Versions |
126+
| ------- | ------------ |
127+
| Arazzo | 1.0.x |
128+
| OpenAPI | 3.0.0, 3.1.0 |

0 commit comments

Comments
 (0)