Document pull request detail route in OpenAPI
swadhinbiswas committed 8 months ago
d817506
1 parent f41974f
commit d817506
3 files changed
+52 -1
Showing 3 changed files+52-1
▼doc/feature_audit.md
+1-1
| @@ -200,7 +200,7 @@ | ||
200 | 200 | | CLI | ✅ | `cli/` package - 21+ commands | |
201 | 201 | | Plugin/extension system | ⚠️ | `plugins.ts` infrastructure exists, but basic | |
202 | 202 | | Webhook events | ✅ | Full implementation | |
203 | -| API documentation | ⚠️ | OpenAPI coverage now includes AI callback and AI review trigger/read routes, review/comment flows (including path-scoped comment visibility metadata), stack approvals/rebase/auto-update/merge routes, PR bulk-merge/auto-merge/checks/merge/impact/rewrite routes, PR issue-links and file-approvals routes, merge-gate reporting metadata, notifications/email test endpoints, and analytics merge-frequency/workload routes; broader endpoint parity still incomplete | | |
203 | +| API documentation | ⚠️ | OpenAPI coverage now includes AI callback and AI review trigger/read routes, PR detail/update routes, review/comment flows (including path-scoped comment visibility metadata), stack approvals/rebase/auto-update/merge routes, PR bulk-merge/auto-merge/checks/merge/impact/rewrite routes, PR issue-links and file-approvals routes, merge-gate reporting metadata, notifications/email test endpoints, and analytics merge-frequency/workload routes; broader endpoint parity still incomplete | | |
204 | 204 | |
205 | 205 | ## 12. Self-Hosted & Deployment |
206 | 206 | | Feature | Status | Implementation Notes | |
207 | 207 | |
▼src/lib/openapi.ts
+50-0
| @@ -586,6 +586,56 @@ export const openApiSpec = { | ||
586 | 586 | }, |
587 | 587 | }, |
588 | 588 | }, |
589 | + "/repos/{owner}/{repo}/pulls/{number}": { | |
590 | + get: { | |
591 | + tags: ["Pull Requests"], | |
592 | + summary: "Get pull request details", | |
593 | + security: [{ bearerAuth: [] }], | |
594 | + parameters: [ | |
595 | + { name: "owner", in: "path", required: true, schema: { type: "string" } }, | |
596 | + { name: "repo", in: "path", required: true, schema: { type: "string" } }, | |
597 | + { name: "number", in: "path", required: true, schema: { type: "integer" } }, | |
598 | + ], | |
599 | + responses: { | |
600 | + 200: { description: "Pull request returned" }, | |
601 | + 400: { description: "Missing parameters", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } }, | |
602 | + 404: { description: "Repository or pull request not found", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } }, | |
603 | + }, | |
604 | + }, | |
605 | + patch: { | |
606 | + tags: ["Pull Requests"], | |
607 | + summary: "Update pull request metadata or workflow state", | |
608 | + description: "Updates PR title/body and transitions canonical or custom state with reviewer/codeowner merge-gate checks where configured.", | |
609 | + security: [{ bearerAuth: [] }], | |
610 | + parameters: [ | |
611 | + { name: "owner", in: "path", required: true, schema: { type: "string" } }, | |
612 | + { name: "repo", in: "path", required: true, schema: { type: "string" } }, | |
613 | + { name: "number", in: "path", required: true, schema: { type: "integer" } }, | |
614 | + ], | |
615 | + requestBody: { | |
616 | + required: true, | |
617 | + content: { | |
618 | + "application/json": { | |
619 | + schema: { | |
620 | + type: "object", | |
621 | + properties: { | |
622 | + title: { type: "string" }, | |
623 | + body: { type: "string" }, | |
624 | + state: { type: "string" }, | |
625 | + }, | |
626 | + }, | |
627 | + }, | |
628 | + }, | |
629 | + }, | |
630 | + responses: { | |
631 | + 200: { description: "Pull request updated" }, | |
632 | + 400: { description: "Invalid update payload or transition", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } }, | |
633 | + 401: { description: "Unauthorized", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } }, | |
634 | + 403: { description: "Forbidden", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } }, | |
635 | + 404: { description: "Repository or pull request not found", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } }, | |
636 | + }, | |
637 | + }, | |
638 | + }, | |
589 | 639 | "/repos/{owner}/{repo}/stacks/{stackId}/approvals": { |
590 | 640 | get: { |
591 | 641 | tags: ["Stacks"], |
592 | 642 | |
▼tests/unit/openapi-routes.test.ts
+1-0
| @@ -6,6 +6,7 @@ describe("openapi route parity", () => { | ||
6 | 6 | const paths = openApiSpec.paths as Record<string, unknown>; |
7 | 7 | |
8 | 8 | expect(paths["/repos/{owner}/{repo}/pulls/{number}/ai-review"]).toBeTruthy(); |
9 | + expect(paths["/repos/{owner}/{repo}/pulls/{number}"]).toBeTruthy(); | |
9 | 10 | expect(paths["/repos/{owner}/{repo}/pulls/{number}/merge"]).toBeTruthy(); |
10 | 11 | expect(paths["/repos/{owner}/{repo}/pulls/{number}/impact"]).toBeTruthy(); |
11 | 12 | expect(paths["/repos/{owner}/{repo}/pulls/{number}/rewrite"]).toBeTruthy(); |
12 | 13 | |