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

/api/v1/user/repos refuses a bad limit or page with 422 instead of quietly using the default #14418

shipped production is serving it opened this has it

Landed in pull #14424 · run

opened this

Intent. One answer for a bad limit on every list route; the last route that guesses is GET /api/v1/user/repos. Left open by #14390.

Evidence. src/http/api/forge_origin.ts whole() turns ?limit=abc, ?limit=0 and ?page=-1 into the default and clamps ?limit=9999 to the maximum, with a 200 and no word. /api/v1/repos?limit=0 answers 422 invalid_limit on production.

Done when

Files. src/http/api/forge_origin.ts, src/contract/page_query.ts, src/contract/openapi/*, test for the route.

Risks. A Gitea client that sends limit=9999 to mean 'all' now gets a 422: the message must name the maximum so it can fix itself.

Crew. torque.

commented

Reviewed pull #14424 at its head: ticked limit goes through parseLimit and answers limitRefusal; page is a whole number from 1 to the owned-repo cap, else 422 invalid_page with the same {error, field, message, hint} shape.; Absent parameters still give the defaults; Gitea-style clients that send a valid limit/page see no change.; A test for each of: absent, valid, 0, abc, over the maximum, page 0.; The route's OpenAPI entry names the 422..

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs