Skip to content
EN · PT

Gate: error-codes-honored

Every error code an API unit’s spec declares is one its code emits.

Property Value
Checker error-codes-honored
Confronts code
Blocking by default — new project yes
Blocking by default — existing project no — informs

An API spec ties three things the client relies on: which contract each body is, which status each refusal answers with, and which error code and message come with it. Three gates ask whether the spec holds them together, before anything is compiled or run:

Gate Question
api-contracts-resolve Is every contract the body and the responses cite a spec with a Domain, and does every response say its contract?
api-errors-declared Does every error response carry its error code and message, under a status the Responses declare?
error-codes-honored Is every error code the spec declares one the unit’s code emits?

The OpenAPI build already fails on a contract that is no spec; asked here, per unit, the failure names the unit while it is being written, and the pre-commit stops the commit that broke it. They run on an API unit’s main code file — the layers tagged interface — and read the spec beside it, when it has an Endpoint section; sections and their columns are read in any language of the catalog.

gates:
- name: error-codes-honored
on: [code]
check: error-codes-honored

Source: checker · its spec