Public: anyone can read this; the crew can change it.
The OpenAPI document describes reading and closing one issue and reading one pull #3326
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/3271-the-openapi-document-describes-reading-a → main 1 commit fork
2 files
changed +22
−0
src/contract/openapi.ts +9
| @@ -36,6 +36,15 @@ export const ROUTES: readonly Route[] = [ | ||
| 36 | 36 | auth: true, |
| 37 | 37 | body: { title: "string", body: "string" }, |
| 38 | 38 | }, |
| 39 | { method: "get", path: `${REPO}/issues/{number}`, summary: "Read one issue with its comments", auth: false }, | |
| 40 | { | |
| 41 | method: "patch", | |
| 42 | path: `${REPO}/issues/{number}`, | |
| 43 | summary: "Close or reopen an issue (state, with a reason and the issue it went into)", | |
| 44 | auth: true, | |
| 45 | body: { state: "string", reason: "string", into: "integer" }, | |
| 46 | }, | |
| 47 | { method: "get", path: `${REPO}/pulls/{number}`, summary: "Read one pull with its diff and review gate", auth: false }, | |
| 39 | 48 | { |
| 40 | 49 | method: "post", |
| 41 | 50 | path: `${REPO}/issues/{number}/comments`, |
test/openapi.test.ts +13
| @@ -46,3 +46,16 @@ test("the map, plan and dependency routes are described", () => { | ||
| 46 | 46 | const del = doc.paths[`${R}/issues/{number}/dependencies/{blocker}`].delete; |
| 47 | 47 | expect(del.parameters.find((p: any) => p.name === "blocker").schema.type).toBe("integer"); |
| 48 | 48 | }); |
| 49 | ||
| 50 | test("reading and closing one issue and reading one pull are described", () => { | |
| 51 | const doc = openapi("https://f.test", "1") as any; | |
| 52 | const R = "/api/v1/repos/{owner}/{name}"; | |
| 53 | const issue = doc.paths[`${R}/issues/{number}`]; | |
| 54 | expect(issue.get.security).toBeUndefined(); | |
| 55 | expect(issue.patch.security).toBeDefined(); | |
| 56 | const props = issue.patch.requestBody.content["application/json"].schema.properties; | |
| 57 | expect(Object.keys(props).sort()).toEqual(["into", "reason", "state"]); | |
| 58 | expect(props.into.type).toBe("integer"); | |
| 59 | expect(issue.patch.parameters.find((p: any) => p.name === "number").in).toBe("path"); | |
| 60 | expect(doc.paths[`${R}/pulls/{number}`].get.security).toBeUndefined(); | |
| 61 | }); |
new above
offline