Public: anyone can read this; the crew can change it.
The OpenAPI document describes starting a migration and reading its job #3349
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/3341-the-openapi-document-describes-starting → main 5 commits fork 2 threads · 2 unresolved
2 files
changed +20
−0
src/contract/openapi.ts +8
| @@ -122,6 +122,14 @@ export const ROUTES: readonly Route[] = [ | ||
| 122 | 122 | summary: "Stop an issue waiting for another", |
| 123 | 123 | auth: true, |
| 124 | 124 | }, |
| 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" }, | |
| 131 | }, | |
| 132 | { method: "get", path: "/api/v1/migrate/{job}", summary: "Read a migration job's stage", auth: true }, | |
| 125 | 133 | { |
| 126 | 134 | method: "post", |
| 127 | 135 | path: "/mcp", |
test/openapi.test.ts +12
| @@ -47,6 +47,18 @@ test("the map, plan and dependency routes are described", () => { | ||
| 47 | 47 | expect(del.parameters.find((p: any) => p.name === "blocker").schema.type).toBe("integer"); |
| 48 | 48 | }); |
| 49 | 49 | |
| 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 | ||
| 50 | 62 | test("listing issues and pulls is described with the query the handlers read", () => { |
| 51 | 63 | const doc = openapi("https://f.test", "1") as any; |
| 52 | 64 | const R = "/api/v1/repos/{owner}/{name}"; |
new above
offline
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.