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

The OpenAPI document describes reading and closing one issue and reading one pull #3326

Merged opened this

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

Merged

scout/forge:scout/3271-the-openapi-document-describes-reading-a → main 1 commit fork

  • Merged. scout/3271-the-openapi-document-describes-reading-a was merged into main as 39bc4c4.

Review

Sign in to review this change.
2 files changed +22 −0
src/contract/openapi.ts +9
@@ -36,6 +36,15 @@ export const ROUTES: readonly Route[] = [
3636 auth: true,
3737 body: { title: "string", body: "string" },
3838 },
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 },
3948 {
4049 method: "post",
4150 path: `${REPO}/issues/{number}/comments`,
test/openapi.test.ts +13
@@ -46,3 +46,16 @@ test("the map, plan and dependency routes are described", () => {
4646 const del = doc.paths[`${R}/issues/{number}/dependencies/{blocker}`].delete;
4747 expect(del.parameters.find((p: any) => p.name === "blocker").schema.type).toBe("integer");
4848 });
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 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs