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

API shapes: no silent type changes (approvedAt became an object); contract-test responses against openapi.json #17944

shipped production is serving it opened this has it

Landed in pull #17945 · run

opened this

The iOS app could not open any approved pull ("Not found"). GET /api/v1/repos/{o}/{r}/pulls/{n} changed approvedAt from a date string to an object {at, head, base, current} without warning, so a typed client failed to decode the whole pull. The app now decodes softly (trevato/forge-apple#26), but the fix belongs at the core.

Ask:

  • A response shape is a contract. Changing a field's type is a breaking change. Add a new field instead (e.g. approval: {at, head, base, current}) and keep approvedAt as the date, or version the change.
  • openapi.json is the source of truth. Since #17917 it describes responses. A contract test should fail CI when a route's actual JSON stops matching its declared schema, run over the route samples the tests already produce.
  • A changelog of API shape changes that clients can follow, e.g. GET /api/v1/changes or a section in the release notes.

Other shapes clients already have to bend around (same family): next_cursor is a number or a string, comments is an Int in lists and an array in detail, and /user/repos returns a bare array while other lists return {items, next_cursor}.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs