fix: revert swagger-jsdoc to 6.2.8 (7.0.0-rc.6 broke OpenAPI spec generation) + add OpenAPI spec tests
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
swagger-jsdoc 7.0.0-rc.6 returns empty spec (0 paths), breaking /docs and /openapi.json. Reverted to 6.2.8 which correctly generates all 10+ paths. Added 2 regression tests to catch this in CI.
This commit is contained in:
parent
6fd707ab64
commit
288d6c7aab
3 changed files with 66 additions and 22 deletions
|
|
@ -585,6 +585,27 @@ describe("Rate limit headers on PDF endpoints", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("OpenAPI spec", () => {
|
||||
it("returns a valid OpenAPI 3.0 spec with paths", async () => {
|
||||
const res = await fetch(`${BASE}/openapi.json`);
|
||||
expect(res.status).toBe(200);
|
||||
const spec = await res.json();
|
||||
expect(spec.openapi).toBe("3.0.3");
|
||||
expect(spec.info).toBeDefined();
|
||||
expect(spec.info.title).toBe("DocFast API");
|
||||
expect(Object.keys(spec.paths).length).toBeGreaterThanOrEqual(8);
|
||||
});
|
||||
|
||||
it("includes all major endpoint groups", async () => {
|
||||
const res = await fetch(`${BASE}/openapi.json`);
|
||||
const spec = await res.json();
|
||||
const paths = Object.keys(spec.paths);
|
||||
expect(paths).toContain("/v1/convert/html");
|
||||
expect(paths).toContain("/v1/convert/markdown");
|
||||
expect(paths).toContain("/health");
|
||||
});
|
||||
});
|
||||
|
||||
describe("404 handler", () => {
|
||||
it("returns proper JSON error format for API routes", async () => {
|
||||
const res = await fetch(`${BASE}/v1/nonexistent-endpoint`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue