Pcornel
Automation · APIs

OpenAPI

Cheat sheet · https://pcornel.dk/topic.php?topic=5316

Back to the Topic

Answer

Machine-readable API contract describing operations, parameters, schemas, responses and security schemes for tooling and documentation.

Remember

  • OpenAPI document ≠ deployed runtime truth; implementation and specification can drift.
  • Schema valid ≠ business rule complete; OpenAPI cannot express every semantic constraint.
  • Generated client ≠ correct integration automatically; defaults, retries, auth and version lifecycle still require review.
  • Documented response ≠ only possible response; gateways and infrastructure can add errors outside the spec.

First checks

  • npx @redocly/cli lint openapi.yaml — lint spec
  • openapi-generator-cli generate -i openapi.yaml -g python -o client — generate client
  • Spec version and API version match — consistency

Verify in this order

OpenAPI spec → docs/clients/validation

Where it usually breaks

An OpenAPI document proves the declared interface contract, not that the deployed service implements every detail or business rule.

OpenAPI API boundary map

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind retries, credential rotation, replay or payload edits before evidence is captured

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5316

Confirmation

Confirm action

Continue?