Punk API · API Governance Rules
Punk API API Rules
Spectral linting rules defining API design standards and conventions for Punk API.
36 Rules
error 11
warn 21
info 4
Rule Categories
get
info
no
openapi
operation
parameter
paths
query
read
response
schema
servers
tag
Rules
warn
info-title-punkapi-prefix
Spec title should begin with "Punk API".
$.info
error
info-description-required
Spec must include a non-empty description.
$.info
error
info-version-required
Spec must declare a version.
$.info
warn
info-license-required
Spec must include license info (Punk API is MIT-licensed).
$.info
warn
info-deprecation-status
Spec must declare x-status (deprecated for the public Punk API).
$.info
warn
openapi-version-3-0-3
Specs must target OpenAPI 3.0.x.
$.openapi
error
servers-https-required
Production server URLs must use HTTPS.
$.servers[0].url
warn
servers-punkapi-host
Production server URL must point at api.punkapi.com/v2.
$.servers[0].url
error
paths-lowercase
Paths must be lowercase.
$.paths.*~
error
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths.*~
warn
paths-beers-resource
Punk API only exposes /beers, /beers/{beerId}, and /beers/random.
$.paths.*~
error
operation-summary-required
Every operation must have a summary.
$.paths.*[get,post,put,patch,delete]
warn
operation-description-required
Every operation must have a description.
$.paths.*[get,post,put,patch,delete]
warn
operation-summary-punkapi-prefix
Every operation summary must start with "Punk API".
$.paths.*[get,post,put,patch,delete].summary
error
operation-operationid-required
Every operation must declare an operationId.
$.paths.*[get,post,put,patch,delete]
warn
operation-operationid-camelcase
operationId must be camelCase.
$.paths.*[get,post,put,patch,delete].operationId
info
operation-operationid-verb-prefix
operationId should begin with list/get.
$.paths.*[get,post,put,patch,delete].operationId
error
operation-tags-required
Every operation must declare at least one tag.
$.paths.*[get,post,put,patch,delete]
warn
operation-tag-beers
All operations must be tagged 'Beers'.
$.paths.*[get,post,put,patch,delete].tags
info
operation-microcks-extension
Every operation should declare x-microcks-operation.
$.paths.*[get,post,put,patch,delete]
warn
tag-title-case
Global tag names must use Title Case.
$.tags[*].name
warn
tag-description-required
Each global tag must include a description.
$.tags[*]
warn
parameter-description-required
Every parameter must have a description.
$.paths.*[get,post,put,patch,delete].parameters[*]
warn
parameter-snake-or-camel
Query parameter names use snake_case (Punk API convention) or camelCase (beerId).
$.paths.*[get,post,put,patch,delete].parameters[*].name
info
query-pagination-pair
Pagination uses the pair (page, per_page).
$.paths.*[get].parameters[?(@.in=='query')].name
error
response-success-required
Every operation must define a 2xx success response.
$.paths.*[get,post,put,patch,delete].responses
warn
response-description-required
Every response must have a description.
$.paths.*[get,post,put,patch,delete].responses.*
warn
response-json-content
Success responses must return application/json.
$.paths.*[get,post,put,patch,delete].responses[?(@property.match(/^2\d\d$/))].content
info
response-error-envelope
4xx/5xx responses should reference the shared Error schema.
$.paths.*[get,post,put,patch,delete].responses[?(@property.match(/^(4|5)\d\d$/))].content.application/json.schema
warn
schema-property-snake-case
Beer schema property names use snake_case (matches the Punk API JSON shape).
$.components.schemas.Beer.properties.*~
warn
schema-description-required
Top-level schemas must include a description.
$.components.schemas.*
error
schema-type-required
Top-level schemas must declare a type.
$.components.schemas.*
warn
schema-beer-required-fields
Beer schema must require id, name, abv, ingredients, method.
$.components.schemas.Beer
error
get-no-request-body
GET operations must not declare a request body.
$.paths.*.get
warn
read-only-surface
Punk API exposes a read-only surface (GET only).
$.paths.*
warn
no-empty-descriptions
Descriptions must be non-empty when present.
$..description