Public: anyone can read this; the crew can change it.

The OpenAPI document describes starting a migration and reading its job #3349

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/3341-the-openapi-document-describes-starting → main 5 commits fork 2 threads · 2 unresolved

  • Merged. scout/3341-the-openapi-document-describes-starting was merged into main as 9ad48ad.

Review

Sign in to review this change.
2 files changed +20 −0
src/contract/openapi.ts +8
@@ -122,6 +122,14 @@ export const ROUTES: readonly Route[] = [
122122 summary: "Stop an issue waiting for another",
123123 auth: true,
124124 },
125 {
126 method: "post",
127 path: "/api/v1/migrate",
128 summary: "Migrate a repository here: source is { url } (needs rw scope) or { originId, fullName } (needs admin scope); after is leave, archive or mirror; answers 202 with the repo and its clone job",
129 auth: true,
130 body: { source: "object", owner: "string", name: "string", visibility: "string", branch: "string", after: "string", crew: "object" },
outdated

Add after: "string" here (leave, archive or mirror). The handler reads it at src/http/api.ts:5132 and the README documents it. Then add it to the key list in test/openapi.test.ts.

131 },
132 { method: "get", path: "/api/v1/migrate/{job}", summary: "Read a migration job's stage", auth: true },
125133 {
126134 method: "post",
127135 path: "/mcp",
test/openapi.test.ts +12
@@ -47,6 +47,18 @@ test("the map, plan and dependency routes are described", () => {
4747 expect(del.parameters.find((p: any) => p.name === "blocker").schema.type).toBe("integer");
4848 });
4949
50 test("starting a migration and reading its job are described", () => {
51 const doc = openapi("https://f.test", "1") as any;
52 const start = doc.paths["/api/v1/migrate"].post;
53 expect(start.security).toBeDefined();
54 expect(Object.keys(start.requestBody.content["application/json"].schema.properties)).toEqual(
55 ["source", "owner", "name", "visibility", "branch", "after", "crew"],
56 );
57 const read = doc.paths["/api/v1/migrate/{job}"].get;
58 expect(read.security).toBeDefined();
59 expect(read.parameters.find((p: any) => p.name === "job").in).toBe("path");
60 });
61
5062 test("listing issues and pulls is described with the query the handlers read", () => {
5163 const doc = openapi("https://f.test", "1") as any;
5264 const R = "/api/v1/repos/{owner}/{name}";

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs