Skip to content

ci: export OpenAPI spec as CI artifact (#40) - #76

Closed
temisan0x wants to merge 1 commit into
VertexChainLabs:mainfrom
temisan0x:ci/openapi-spec-export
Closed

ci: export OpenAPI spec as CI artifact (#40)#76
temisan0x wants to merge 1 commit into
VertexChainLabs:mainfrom
temisan0x:ci/openapi-spec-export

Conversation

@temisan0x

Copy link
Copy Markdown
Contributor

Closes #40

What this does

Adds a CI step that programmatically exports the NestJS Swagger spec as downloadable artifacts (openapi.json and openapi.yaml), replacing the hardcoded stub in generate-api-docs.sh.

Changes

  • Backend/src/export-spec.ts — headless NestJS bootstrap; builds the Swagger document and writes both formats to infrastructure/docs/
  • Backend/package.json — adds export-spec script (ts-node -r tsconfig-paths/register src/export-spec.ts)
  • infrastructure/scripts/generate-api-docs.sh — replaces hardcoded stub heredoc with npm run export-spec
  • infrastructure/ci/docs-generation.yml — adds Node 20 setup, npm ci, Postgres 15 service container, correct DATABASE_* env vars, and artifact upload for openapi-spec

Why Postgres

AppModule initialises TypeORM on app.init(). A Postgres 15 service container is added to the generate-api-docs job — no migrations run, no tables required, just a live connection. Credentials are isolated to this job and do not affect other CI jobs.

Notes

  • Output paths in export-spec.ts are anchored to __dirname, not cwd, so files always land at repo-root infrastructure/docs/ regardless of where the script is invoked from
  • Spec metadata (title, description, version) matches main.ts
  • app.listen() is never called — headless export only

Copy link
Copy Markdown
Contributor

Smart move @temisan0x — exporting OpenAPI from CI means downstream tools and docs can stay in sync automatically. Thanks! ✅

Copy link
Copy Markdown
Contributor

@temisan0x — heads-up: alongside the other merges that just landed in main, PR #76 now shows a content-level conflict in Backend/package-lock.json. To preserve your commit authorship cleanly, could you rebase PR #76 onto current main and push? Once it is conflict-free, I will merge immediately. Thanks for the OpenAPI artifact work! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: add OpenAPI spec export to CI pipeline

2 participants