Fix gen-openapi to quote OpenAPI version fields for Mintlify validation#1656
Fix gen-openapi to quote OpenAPI version fields for Mintlify validation#1656
Conversation
|
✱ Stainless preview buildsThis PR will update the
|
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant CI as Developer/CI
participant Script as gen-openapi.ts
participant App as Fastify Server
participant FS as File System (openapi.v3.yaml)
participant Mint as Mintlify Docs
Note over CI,Mint: OpenAPI Specification Generation & Validation Flow
CI->>Script: Run generation script
Script->>App: app.ready()
App-->>Script: Server initialized
Script->>App: app.swagger({ yaml: true })
App-->>Script: Return raw YAML string
Note right of Script: CHANGED: Post-process YAML string<br/>Apply regex to quote version fields
Script->>Script: NEW: .replace() openapi: 3.1.0 -> "3.1.0"
Script->>Script: NEW: .replace() version: 3.1.0 -> "3.1.0"
Script->>FS: writeFile(OUTPUT_PATH, fixedYaml)
FS-->>Script: Write successful
Script->>App: app.close()
Note over FS,Mint: Documentation Deployment
Mint->>FS: Load openapi.v3.yaml
alt Validation Logic
Mint->>Mint: Validate 'openapi' is string
Mint->>Mint: Validate 'info.version' is string
Mint-->>CI: Success: Docs Deployed
else Validation Failure (Old Behavior)
Mint-->>CI: Error: Bare numbers found
end
Greptile OverviewGreptile SummaryThis PR updates the generated OpenAPI v3 YAML to quote Overall this fits cleanly into the existing generation flow (Fastify + fastify-zod-openapi + fastify-swagger), but the current regex-based fix is brittle if version formatting changes (e.g. prerelease tags). Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer/CI
participant Gen as gen-openapi.ts
participant App as Fastify app
participant Sw as @fastify/swagger
participant FS as openapi.v3.yaml
Dev->>Gen: Run OpenAPI generation script
Gen->>App: Register routes + zod-openapi components
Gen->>Sw: app.swagger({ yaml: true })
Sw-->>Gen: YAML string (may contain unquoted numeric versions)
Gen->>Gen: Regex-replace openapi + info.version to quoted strings
Gen->>FS: writeFile(fixedYaml)
FS-->>Dev: Mintlify validates YAML successfully
|
why
Mintlify requires OpenAPI version fields to be strings and only accepts spec files inside the docs repo. Unclear why this only recently started failing.
what changed
Quote openapi and info.version during OpenAPI generation and point Mintlify at a symlinked
openapi.v3.yamlinside packages/docs.test plan
Confirmed that changes generates correct openapi spec.
Summary by cubic
Quote OpenAPI version fields in the generated YAML so Mintlify validation passes. Fixes errors caused by bare numeric openapi and info.version values.
Written for commit aad5e16. Summary will update on new commits. Review in cubic