Better Stack · API Governance Rules

Better Stack API Rules

Spectral linting rules defining API design standards and conventions for Better Stack.

37 Rules error 13 warn 17 info 7
View Rules File View on GitHub

Rule Categories

examples http info no openapi operation parameter paths request response schema security servers tags

Rules

warn
info-title-prefix
API title should start with "Better Stack"
$.info.title
error
info-description-required
API info must have a description
$.info
warn
info-description-min-length
API description should be at least 30 characters
$.info.description
error
info-version-required
API info must specify a version
$.info
warn
openapi-version
OpenAPI version should be 3.0.x
$.openapi
error
servers-defined
At least one server must be defined
$
error
servers-https-only
All server URLs must use HTTPS
$.servers[*].url
warn
servers-description-required
Each server should have a description
$.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
paths-no-query-string
Query strings must not appear in paths
$.paths
error
operation-summary-required
All operations must have a summary
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-summary-title-case
Operation summaries should start with "Better Stack"
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
All operations must have a description
$.paths[*][get,post,put,patch,delete,head,options]
error
operation-id-required
All operations must have an operationId
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-id-camel-case
operationId should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete,head,options]
info
tags-global-defined
Global tags array should be defined
$
info
tags-description-required
Each global tag should have a description
$.tags[*]
warn
parameter-description-required
All parameters must have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
error
parameter-schema-required
All parameters must have a schema
$.paths[*][get,post,put,patch,delete].parameters[*]
info
parameter-snake-case
Query parameter names should use snake_case
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')].name
warn
request-body-json-content
Request bodies should use application/json content type
$.paths[*][post,put,patch].requestBody.content
error
response-success-required
Every operation must define a 2xx success response
$.paths[*][get,post,put,patch,delete].responses
info
response-401-defined
Operations should define a 401 Unauthorized response
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
All responses must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
warn
schema-description-required
Top-level component schemas should have descriptions
$.components.schemas[*]
info
schema-property-snake-case
Schema property names should use snake_case
$.components.schemas[*].properties
warn
security-global-defined
Global security must be defined
$
error
security-schemes-defined
Security schemes must be defined in components
$.components
info
security-bearer-auth
Better Stack API should use Bearer authentication
$.components.securitySchemes
error
http-get-no-body
GET operations should not have a request body
$.paths[*].get
warn
http-delete-no-body
DELETE operations should not have a request body
$.paths[*].delete
warn
http-post-has-body
POST operations should have a request body
$.paths[*].post
warn
http-patch-has-body
PATCH operations should have a request body
$.paths[*].patch
warn
no-empty-descriptions
Descriptions must not be empty strings
$..description
info
examples-encouraged
Schema properties should include example values
$.components.schemas[*].properties[*]