Trefle · API Governance Rules
Trefle API Rules
Spectral linting rules defining API design standards and conventions for Trefle.
9 Rules
error 3
warn 5
info 1
Rule Categories
trefle
Rules
error
trefle-operation-id-required
All Trefle API operations should have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
trefle-token-auth-documented
The Trefle API uses token-based authentication. The global security scheme should specify the tokenAuth apiKey scheme.
$
error
trefle-response-200-defined
All Trefle API GET operations should define a 200 response.
$.paths[*].get.responses
warn
trefle-response-401-defined
All operations should document 401 Unauthorized for token auth errors.
$.paths[*][get,post,put,patch,delete].responses
warn
trefle-response-404-on-id-paths
Endpoints with path parameters (individual resource lookups) should document the 404 Not Found response.
$.paths[*{id}*][get].responses
warn
trefle-tags-required
All operations should have at least one tag for navigation.
$.paths[*][*].tags
warn
trefle-description-required
All operations should have a description.
$.paths[*][*]
error
trefle-summary-required
All operations should have a summary.
$.paths[*][*]
info
trefle-pagination-links
List operations (returning arrays) should include pagination links in the 200 response, consistent with the Trefle API data/links/meta structure.
$.paths[*].get.responses.200