fix: swagger apis path to src/ + update stale signup/verify test refs
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled

- swagger.ts: changed apis glob from dist/routes/*.js to src/routes/*.ts
  so OpenAPI spec includes demo endpoints during tests (fixes 6 test failures)
- Dockerfile: copy src/ to final stage for runtime swagger-jsdoc
- Updated stale /v1/signup/verify test refs to /v1/signup/free (endpoint
  was removed when free tier was discontinued)
This commit is contained in:
OpenClaw Subagent 2026-03-18 20:11:17 +01:00
parent 9e1d4d86fb
commit 392fc029fe
4 changed files with 8 additions and 6 deletions

View file

@ -53,6 +53,7 @@ RUN npm install --omit=dev
# Copy compiled artifacts from builder stage # Copy compiled artifacts from builder stage
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder /app/src ./src
# Recreate swagger-ui symlink in production stage # Recreate swagger-ui symlink in production stage
RUN rm -f public/swagger-ui && ln -s /app/node_modules/swagger-ui-dist public/swagger-ui RUN rm -f public/swagger-ui && ln -s /app/node_modules/swagger-ui-dist public/swagger-ui

View file

@ -101,9 +101,10 @@ describe("App-level routes", () => {
spec = res.body; spec = res.body;
}); });
it("includes POST /v1/signup/verify", () => { it("includes POST /v1/signup/free (deprecated)", () => {
expect(spec.paths["/v1/signup/verify"]).toBeDefined(); expect(spec.paths["/v1/signup/free"]).toBeDefined();
expect(spec.paths["/v1/signup/verify"].post).toBeDefined(); expect(spec.paths["/v1/signup/free"].post).toBeDefined();
expect(spec.paths["/v1/signup/free"].post.deprecated).toBe(true);
}); });
it("excludes GET /v1/billing/success (browser redirect, not public API)", () => { it("excludes GET /v1/billing/success (browser redirect, not public API)", () => {

View file

@ -12,8 +12,8 @@ describe("OpenAPI spec accuracy", () => {
expect(spec.paths).not.toHaveProperty("/v1/billing/success"); expect(spec.paths).not.toHaveProperty("/v1/billing/success");
}); });
it("should mark /v1/signup/verify as deprecated", () => { it("should mark /v1/signup/free as deprecated", () => {
expect(spec.paths["/v1/signup/verify"]?.post?.deprecated).toBe(true); expect(spec.paths["/v1/signup/free"]?.post?.deprecated).toBe(true);
}); });
describe("Rate limit headers", () => { describe("Rate limit headers", () => {

View file

@ -163,7 +163,7 @@ const options: swaggerJsdoc.Options = {
}, },
}, },
}, },
apis: ["./dist/routes/*.js", "./dist/index.js"], apis: ["./src/routes/*.ts", "./src/index.ts"],
}; };
export const swaggerSpec = swaggerJsdoc(options); export const swaggerSpec = swaggerJsdoc(options);