fix(server): document the company export request body in the API catalog

POST /exports and /exports/preview registered no request body, so agents that
discover operations through the API catalog sent none. The defaults export
only the company and agents, and an agent then told a user that the company
had no projects or skills to export. Register companyPortabilityExportSchema
and describe the include defaults, as the legacy /export route already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 committed 2026-11-07 20:25:04 -06:00
1 parent 17b9e10252
commit e7b5673439
2 files changed
+19 -2

No files matched your search

@@ -331,6 +331,15 @@ function loadSpecRoutes() {
}
describe("openapi routes", () => {
it("documents the export include body so agents can request projects and skills", () => {
const spec = buildOpenApiSpec();
for (const path of ["/api/companies/{companyId}/exports", "/api/companies/{companyId}/exports/preview"]) {
const operation = spec.paths[path].post;
const body = operation.requestBody.content["application/json"].schema;
expect(body.properties.include.properties).toMatchObject({ projects: expect.anything(), skills: expect.anything() });
expect(operation.description).toMatch(/include\.projects/);
}
});
it("documents generic webhook provenance headers and accepted responses without a provider-specific endpoint", () => {
const spec = buildOpenApiSpec();
const operation = spec.paths["/api/routine-triggers/public/{publicId}/fire"].post;
+10 -2
View File
@@ -2187,7 +2187,11 @@ registry.registerPath({
path: "/api/companies/{companyId}/exports",
tags: ["companies"],
summary: "Export company data",
request: { params: z.object({ companyId: z.string() }) },
description: "Omitting include exports only the company and agents (projects, skills and issues default to false); set include.projects and include.skills for a reusable company setup.",
request: {
params: z.object({ companyId: z.string() }),
body: jsonBody(companyPortabilityExportSchema),
},
responses: { 200: r.ok(), 401: r.unauthorized },
});
@@ -2196,7 +2200,11 @@ registry.registerPath({
path: "/api/companies/{companyId}/exports/preview",
tags: ["companies"],
summary: "Preview company export",
request: { params: z.object({ companyId: z.string() }) },
description: "Omitting include exports only the company and agents (projects, skills and issues default to false); set include.projects and include.skills for a reusable company setup.",
request: {
params: z.object({ companyId: z.string() }),
body: jsonBody(companyPortabilityExportSchema),
},
responses: { 200: r.ok(), 401: r.unauthorized },
});