API Snap · API Governance Rules
API Snap API Rules
Spectral linting rules defining API design standards and conventions for API Snap.
37 Rules
error 11
warn 18
info 8
Rule Categories
examples
get
info
microcks
openapi
operation
parameter
paths
post
request
response
schema
security
servers
tags
Rules
error
info-title-required
Spec must declare an info.title.
$.info
warn
info-description-required
Spec must declare an info.description with at least 60 characters.
$.info
error
info-version-required
Spec must declare info.version.
$.info
warn
info-contact-required
Spec must declare info.contact with name and url.
$.info.contact
warn
openapi-version-3-0-3
API Snap uses OpenAPI 3.0.3.
$.openapi
error
servers-defined
At least one server must be defined.
$
error
servers-https
All servers must use HTTPS.
$.servers[*].url
info
servers-api-snap
Production server should be https://api-snap.com.
$.servers[*].url
error
paths-api-prefix
All paths must be prefixed with /api/.
$.paths
warn
paths-kebab-case
Path segments must be lowercase kebab-case (e.g. /api/jwt-decode).
$.paths
warn
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths
error
operation-summary-required
Every operation must have a summary in Title Case.
$.paths[*][get,post,put,patch,delete]
warn
operation-description-required
Every operation should have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-id-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-id-camel-case
operationId must be camelCase (e.g. generateQrCode, captureScreenshot).
$.paths[*][get,post,put,patch,delete].operationId
info
operation-id-verb-prefix
operationId should start with a recognized verb (generate, capture, convert, hash, resize, decode, extract, base64).
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
tags-pascal-case
Tags must use PascalCase (e.g. Images, Browser, Documents, Security, Utilities).
$.paths[*][get,post,put,patch,delete].tags[*]
info
tags-from-allowed-set
Tags should be one of the documented categories.
$.paths[*][get,post,put,patch,delete].tags[*]
warn
parameter-description-required
Every parameter must have a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
info
parameter-snake-case
Query parameters use snake_case (full_page) when multi-word.
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')].name
info
parameter-api-key-allowed
api_key query parameter is permitted as an Authorization header alias.
$.paths[*][get,post,put,patch,delete].parameters[?(@.name=='api_key')]
error
request-body-content-required
Request bodies must declare a content map.
$.paths[*][post,put,patch].requestBody
warn
request-body-json-or-multipart
Request bodies should use application/json or multipart/form-data.
$.paths[*][post,put,patch].requestBody.content
error
response-200-required
Every operation must declare a 200 success response.
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-required
Every operation must declare a 401 response (missing/invalid API key).
$.paths[*][get,post,put,patch,delete].responses
warn
response-429-required
Every operation must declare a 429 response (rate limit exceeded).
$.paths[*][get,post,put,patch,delete].responses
warn
response-description-required
Each response must have a description.
$.paths[*][get,post,put,patch,delete].responses[*]
info
schema-camel-case-properties
JSON body and response properties use camelCase (urlSafe, expiresAt).
$.components.schemas[*].properties
warn
schema-type-required
Schema properties must declare a type or $ref.
$.components.schemas[*].properties[*]
error
security-schemes-defined
components.securitySchemes must define at least one scheme.
$.components
warn
security-bearer-auth
BearerAuth security scheme must be defined for the snp_ API key.
$.components.securitySchemes
warn
security-global-required
Top-level security must be declared and reference BearerAuth.
$
error
get-no-request-body
GET operations must not declare a requestBody.
$.paths[*].get
warn
post-has-request-body
POST operations should declare a requestBody.
$.paths[*].post
info
examples-encouraged
Operations should include at least one example for response or request.
$.paths[*][get,post,put,patch,delete].responses[*].content[*]
info
microcks-extension-encouraged
Operations should include x-microcks-operation for mock-server compatibility.
$.paths[*][get,post,put,patch,delete]