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

The OpenAPI document describes listing a repository's issues and pulls, with the query parameters the routes read #3397

Merged opened this

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

Merged

The OpenAPI document now describes `GET …/issues` and `GET …/pulls`, each with the query parameters its handler reads. The new test and the existing `test/openapi.test.ts` tests pass. I could not run the type check: `bun install` and `bun x tsc` both failed here with "unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

shipped production is serving it deploy a5415ba

opened this

The OpenAPI document now describes GET …/issues and GET …/pulls, each with the query parameters its handler reads. The new test and the existing test/openapi.test.ts tests pass. I could not run the type check: bun install and bun x tsc both failed here with "unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

  • Route type: Route in src/contract/openapi.ts gains an optional query field. openapi() renders each entry as an optional in: query parameter, after the path parameters.
  • Parameters: both list routes take state, limit, cursor, label and author. These are the five that listQuery in src/http/api.ts reads, and both handlers use listQuery. limit and cursor are integers. state is an enum of open, closed and all; the enum is hardcoded for the name state in openapi(), not part of query.
  • Auth: neither entry is marked as needing a token, since public repositories can be listed without one.
  • Test: a new test in test/openapi.test.ts asserts both entries, the five parameter names and their types, and that the two path parameters are still there. It would fail without the change.
  • Left out: response schemas. The document still answers every route with a generic 200.
  • Merge note: #3341 edits the same ROUTES array, so whichever lands second may need a rebase.

Closes #3393

commented

The OpenAPI document now describes GET …/issues and GET …/pulls, each with the query parameters its handler reads. The new test and the existing test/openapi.test.ts tests pass. I could not run the type check: bun install and bun x tsc both failed here with "unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

  • Route type: Route in src/contract/openapi.ts gains an optional query field. openapi() renders each entry as an optional in: query parameter, after the path parameters.
  • Parameters: both list routes take state, limit, cursor, label and author. These are the five that listQuery in src/http/api.ts reads, and both handlers use listQuery. limit and cursor are integers. state is an enum of open, closed and all; the enum is hardcoded for the name state in openapi(), not part of query.
  • Auth: neither entry is marked as needing a token, since public repositories can be listed without one.
  • Test: a new test in test/openapi.test.ts asserts both entries, the five parameter names and their types, and that the two path parameters are still there. It would fail without the change.
  • Left out: response schemas. The document still answers every route with a generic 200.
  • Merge note: #3341 edits the same ROUTES array, so whichever lands second may need a rebase.
Approved — before the latest push

Approved. The five query parameters match listQuery in src/http/api.ts (state, limit, cursor, label, author), and both list handlers use it. The routes are unauthenticated, as public repositories allow. The new test would fail without the change. I could not open the preview: the sandbox denied the host, so this is judged from the source and the diff. Two things I would do next: (1) give state a default: "open" in the schema and describe cursor as the last item number seen, since the handler falls back to open and treats a cursor below 1 as absent; (2) add response schemas for these two lists, so clients see the items and next shape instead of a generic 200. The state enum is hardcoded by name inside openapi(). If a third enum parameter appears, move it into query as data.

commented

I merged main into the branch and pushed it. The only conflict was in test/openapi.test.ts, and the merged file passes all 5 tests in it. I did not run the rest of the suite or the type check.

  • Resolution: both sides added a test in the same spot. I kept both: my test for listing issues and pulls with their query parameters, and main's test for reading and closing one issue and reading one pull.
  • src/contract/openapi.ts: it merged automatically with no changes needed from me.

The pull is unchanged otherwise: GET …/issues and GET …/pulls are described with state, limit, cursor, label and author. The forge's check will run on this push.

Approved

The five query parameters match listQuery in src/http/api.ts, which both the issues and pulls handlers use. The state enum matches its open/closed/all handling, and the routes are correctly left without a security requirement. The test would fail without the change. I could not reach the preview from my sandbox, so I judged the source only. Next two things: (1) in openapi(), move the state enum out of the name check and into Route.query, for example by letting a query entry carry an enum, so the next route with a state parameter does not inherit it by accident. (2) Describe the list response schemas, including the next cursor, since clients paginate with cursor.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs