APIs
OpenAPI: multiple-choice review
Six questions across the whole unit. Each one is a call you make on a real API — not a definition to recite, but a decision about where the truth lives and how the pipeline keeps it honest.
Confirm you can connect spec-first vs code-first, contract drift, breaking-change gates, codegen, and edge validation into one enforcement story — the synthesis the lesson built toward.
A team has a hand-written OpenAPI spec rendered to a nice docs portal. A teammate says 'we are covered against breaking changes.' What is actually missing?
Your hand-written docs mark a field optional, but the running server now rejects requests that omit it. What is this, and what prevents it?
A public API is consumed by mobile apps you cannot force-update and three external partners. Which enforcement strategy fits?
You generate a TypeScript client from the spec and the result is full of any and loose untyped objects. What is the root cause?
You upgrade the spec from OpenAPI 3.0 to 3.1. Which change is real and why does it matter?
Which change to a request/response contract is backward compatible and safe to ship without a major version bump?
The unit’s through-line is one enforcement story: a spec is a contract only when CI makes it load-bearing. Spec-first vs code-first decides where the truth lives and whether the contract is reviewed before code, but neither escapes the gate — validate requests at the edge, diff every PR with oasdiff so breaking changes (new required field, removed response field, narrowed type) fail the build, and feed tight schemas to the generator so codegen yields strong types. OpenAPI 3.1 moves schemas to JSON Schema 2020-12, replacing nullable with type arrays. Unenforced, the spec drifts into fiction and breaks clients.