|
| 1 | +# HYPERFLEET-1024 — Automated OpenAPI Pipeline |
| 2 | + |
| 3 | +## Before: Manual Process |
| 4 | + |
| 5 | +```mermaid |
| 6 | +graph LR |
| 7 | + Dev[Developer] -->|1. Edit TypeSpec| TSP[main.tsp] |
| 8 | + TSP -->|2. Run build manually| Schemas[schemas/] |
| 9 | + Schemas -->|3. Create tag manually| Tag[git tag vX.Y.Z] |
| 10 | + Tag -->|4. Push tag| Remote[GitHub] |
| 11 | + Remote -->|5. Upload assets manually| Release[GitHub Release] |
| 12 | + Release -->|6. Copy files manually| Consumer[hyperfleet-api] |
| 13 | +
|
| 14 | + style Dev fill:#f9f,stroke:#333 |
| 15 | + style Release fill:#fbb,stroke:#900 |
| 16 | + style Consumer fill:#fbb,stroke:#900 |
| 17 | +``` |
| 18 | + |
| 19 | +**Pain points:** no version enforcement, no linting, manual release steps, consumers vendor stale copies. |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## After: Fully Automated |
| 24 | + |
| 25 | +```mermaid |
| 26 | +graph LR |
| 27 | + Dev[Developer] -->|1. Edit TypeSpec + bump version| PR[Pull Request] |
| 28 | +
|
| 29 | + subgraph CI ["CI (on every PR)"] |
| 30 | + Build[Rebuild schemas] |
| 31 | + Lint[Spectral lint] |
| 32 | + Version[Version bump check] |
| 33 | + Consistency[Schema consistency] |
| 34 | + end |
| 35 | +
|
| 36 | + PR --> CI |
| 37 | + CI -->|All green| Merge[Merge to main] |
| 38 | +
|
| 39 | + subgraph Release ["Release (on push to main)"] |
| 40 | + Extract[Extract version from main.tsp] |
| 41 | + TagCreate[Create git tag] |
| 42 | + Publish[Publish GitHub Release + 4 artifacts] |
| 43 | + end |
| 44 | +
|
| 45 | + Merge --> Release |
| 46 | +
|
| 47 | + Release -->|Go module import| Consumer[hyperfleet-api] |
| 48 | +
|
| 49 | + style Dev fill:#f9f,stroke:#333 |
| 50 | + style CI fill:#e6f3ff,stroke:#369 |
| 51 | + style Release fill:#e6ffe6,stroke:#393 |
| 52 | + style Consumer fill:#e6ffe6,stroke:#393 |
| 53 | +``` |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## Key Benefits |
| 58 | + |
| 59 | +```mermaid |
| 60 | +graph TB |
| 61 | + A["Version discipline enforced"] --- B["Schemas always match TypeSpec sources"] |
| 62 | + B --- C["OpenAPI linting on every PR"] |
| 63 | + C --- D["Zero-touch releases on merge"] |
| 64 | + D --- E["Go module: single source of truth"] |
| 65 | +
|
| 66 | + style A fill:#dcedc8,stroke:#558b2f |
| 67 | + style B fill:#dcedc8,stroke:#558b2f |
| 68 | + style C fill:#dcedc8,stroke:#558b2f |
| 69 | + style D fill:#dcedc8,stroke:#558b2f |
| 70 | + style E fill:#dcedc8,stroke:#558b2f |
| 71 | +``` |
| 72 | + |
| 73 | +| Before | After | |
| 74 | +|--------|-------| |
| 75 | +| Manual `git tag` + `gh release create` | Automatic on merge to main | |
| 76 | +| No linting gate | Spectral OAS lint on every PR | |
| 77 | +| Version bumps easily forgotten | CI blocks merge if version unchanged | |
| 78 | +| Consumers copy `openapi.yaml` by hand | `go get` pulls versioned schemas | |
| 79 | +| Schema drift between source and committed files | CI rebuilds and diffs against committed schemas | |
0 commit comments