affirm · API Governance Rules

affirm API Rules

Spectral linting rules defining API design standards and conventions for affirm.

35 Rules error 16 warn 17 info 2
View Rules File View on GitHub

Rule Categories

delete get info no openapi operation parameter paths request response schema security servers tag

Rules

error
info-title-required
API title must be present and start with "Affirm"
$.info
warn
info-title-affirm-prefix
API title must start with "Affirm"
$.info.title
error
info-description-required
API info must have a description
$.info
error
info-version-required
API version must be present
$.info
warn
info-contact-required
Contact information should be provided
$.info
error
openapi-version
OpenAPI version must be 3.x
$
error
servers-defined
Servers must be defined
$
error
servers-https
All server URLs must use HTTPS
$.servers[*].url
warn
servers-description
Server entries should have descriptions
$.servers[*]
warn
paths-kebab-case
Path segments should use kebab-case
$.paths[*]~
error
paths-no-trailing-slash
Paths must not have trailing slashes
$.paths[*]~
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-affirm-prefix
Operation summaries must start with "Affirm"
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation must have a description
$.paths[*][get,post,put,patch,delete]
error
operation-operationid-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-camel-case
OperationIds should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
error
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
tag-global-defined
Global tags array should be defined
$
warn
tag-description
Tags should have descriptions
$.tags[*]
warn
parameter-description-required
All parameters must have descriptions
$.paths[*][get,post,put,patch,delete].parameters[*]
error
parameter-schema-type
Parameters must have a schema with a type
$.paths[*][get,post,put,patch,delete].parameters[*].schema
warn
request-body-description
Request bodies should have descriptions
$.paths[*][post,put,patch].requestBody
warn
request-body-json-content
Request bodies should include application/json content type
$.paths[*][post,put,patch].requestBody.content
error
response-success-required
Every operation must have a 2xx success response
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
All response objects must have descriptions
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-401-defined
Operations using auth should document 401 responses
$.paths[*][get,post,put,patch,delete].responses
warn
schema-description
Top-level schemas should have descriptions
$.components.schemas[*]
info
schema-properties-snake-case
Schema property names should use snake_case
$.components.schemas[*].properties[*]~
warn
schema-type-defined
Schema objects should have a type defined
$.components.schemas[*]
error
security-schemes-defined
Security schemes must be defined in components
$.components
warn
security-global-defined
Global security should be defined
$
error
get-no-request-body
GET operations must not have request bodies
$.paths[*].get
warn
delete-no-request-body
DELETE operations should not have request bodies
$.paths[*].delete
error
no-empty-descriptions
Descriptions must not be empty strings
$..description
info
operation-examples-encouraged
Operations should have examples for better documentation
$.paths[*][get,post,put,patch,delete].responses[*].content.application/json