Document pull request create and template APIs

swadhinbiswas committed 8 months ago
e655053
1 parent f8e3815
commit e655053
3 files changed
+56 -1
▼doc/feature_audit.md
+1-1
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, 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, plus parity guard tests for `pulls/{number}` route documentation; broader endpoint parity still incomplete |
203
+| API documentation | ⚠️ | OpenAPI coverage now includes AI callback and AI review trigger/read routes, PR create/detail/update/template 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, plus parity guard tests for `pulls/{number}` route documentation; 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
+53-0
1194
1194
},
1195
1195
},
1196
1196
},
1197
+ "/repos/{owner}/{repo}/pulls": {
1198
+ post: {
1199
+ tags: ["Pull Requests"],
1200
+ summary: "Create pull request",
1201
+ description: "Creates a pull request from head branch into base branch, computes diff stats, and triggers reviewer/automation workflows.",
1202
+ security: [{ bearerAuth: [] }],
1203
+ parameters: [
1204
+ { name: "owner", in: "path", required: true, schema: { type: "string" } },
1205
+ { name: "repo", in: "path", required: true, schema: { type: "string" } },
1206
+ ],
1207
+ requestBody: {
1208
+ required: true,
1209
+ content: {
1210
+ "application/json": {
1211
+ schema: {
1212
+ type: "object",
1213
+ properties: {
1214
+ title: { type: "string" },
1215
+ body: { type: "string" },
1216
+ base: { type: "string" },
1217
+ head: { type: "string" },
1218
+ },
1219
+ required: ["title", "base", "head"],
1220
+ },
1221
+ },
1222
+ },
1223
+ },
1224
+ responses: {
1225
+ 201: { description: "Pull request created" },
1226
+ 400: { description: "Invalid payload or branch configuration", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } },
1227
+ 401: { description: "Unauthorized", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } },
1228
+ 403: { description: "Forbidden", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } },
1229
+ 404: { description: "Repository or branch not found", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } },
1230
+ },
1231
+ },
1232
+ },
1233
+ "/repos/{owner}/{repo}/pulls/templates": {
1234
+ get: {
1235
+ tags: ["Pull Requests"],
1236
+ summary: "Get pull request template",
1237
+ description: "Loads PR template content from common repository template locations for a target branch.",
1238
+ security: [{ bearerAuth: [] }],
1239
+ parameters: [
1240
+ { name: "owner", in: "path", required: true, schema: { type: "string" } },
1241
+ { name: "repo", in: "path", required: true, schema: { type: "string" } },
1242
+ { name: "branch", in: "query", required: false, schema: { type: "string" } },
1243
+ ],
1244
+ responses: {
1245
+ 200: { description: "Template content returned (or null)" },
1246
+ 404: { description: "Repository not found", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } } },
1247
+ },
1248
+ },
1249
+ },
1197
1250
"/repos/{owner}/{repo}/pulls/stack-order": {
1198
1251
post: {
1199
1252
tags: ["Pull Requests"],
1200
1253
▼tests/unit/openapi-routes.test.ts
+2-0
5
5
it("includes key pull request lifecycle and integration routes", () => {
6
6
const paths = openApiSpec.paths as Record<string, unknown>;
7
7
8
+ expect(paths["/repos/{owner}/{repo}/pulls"]).toBeTruthy();
9
+ expect(paths["/repos/{owner}/{repo}/pulls/templates"]).toBeTruthy();
8
10
expect(paths["/repos/{owner}/{repo}/pulls/{number}/ai-review"]).toBeTruthy();
9
11
expect(paths["/repos/{owner}/{repo}/pulls/{number}"]).toBeTruthy();
10
12
expect(paths["/repos/{owner}/{repo}/pulls/{number}/merge"]).toBeTruthy();
11
13