Cat Facts (catfact.ninja) · API Governance Rules
Cat Facts (catfact.ninja) API Rules
Spectral linting rules defining API design standards and conventions for Cat Facts (catfact.ninja).
37 Rules
error 8
warn 25
info 4
Authorship not recorded
No authorship marker is recorded for this file. It is not presented as the provider's; it was most likely written by an API Evangelist pass before outputs were stamped.
Rule Categories
examples
info
microcks
only
openapi
operation
parameter
paths
response
schema
security
servers
tags
Rules
warn
info-contact-email-required
info.contact.email must be present and use the catfact.ninja domain.
$.info.contact
warn
info-title-prefix-cat-facts
info.title must begin with "Cat Facts" so consumers can identify the provider.
$.info
warn
info-description-min-length
info.description must be at least 80 characters and explain the surface.
$.info
error
openapi-version-3-required
Use OpenAPI 3.0.x or later — never Swagger 2.0.
$
error
servers-https-only
Every server URL must use HTTPS.
$.servers[*]
warn
servers-must-be-catfact-ninja
Server host must be catfact.ninja — there are no staging or per-tenant hosts.
$.servers[*]
warn
servers-description-required
Server entries must include a description.
$.servers[*]
warn
paths-kebab-case
Path segments must be lowercase kebab-case (a-z, 0-9, hyphen).
$.paths.*~
error
paths-no-trailing-slash
Paths must not end with a trailing slash (except the root).
$.paths.*~
error
paths-no-query-string
Paths must not embed query strings — declare parameters instead.
$.paths.*~
error
operation-operationid-required
Every operation must declare an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-camel-case
operationId must be camelCase (e.g. getRandomFact, getFacts, getBreeds).
$.paths[*][get,post,put,patch,delete]
error
operation-summary-required
Every operation must include a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-title-case
Operation summaries must use Title Case (every word capitalised except small words such as a/an/the/and/or/of/in/on/at/to/by/for/from/with/as/is/it/its/vs/via).
$.paths[*][get,post,put,patch,delete]
warn
operation-description-required
Every operation must include a description.
$.paths[*][get,post,put,patch,delete]
warn
operation-tags-required
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
error
operation-get-no-request-body
GET operations must not declare a requestBody.
$.paths[*].get
warn
tags-global-defined
A global tags array must be defined.
$
warn
tags-title-case
Tag names must be Title Case (Facts, Breeds).
$.tags[*]
warn
tags-description-required
Each global tag must have a description.
$.tags[*]
warn
parameter-snake-case
Query parameter names must be snake_case (e.g. max_length).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
parameter-description-required
Every parameter must include a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
warn
parameter-schema-type-required
Every parameter schema must declare a type.
$.paths[*][get,post,put,patch,delete].parameters[*].schema
warn
parameter-limit-is-integer
The 'limit' query parameter must be an integer.
$.paths[*][get,post,put,patch,delete].parameters[?(@.name=='limit')].schema
warn
parameter-max-length-is-integer
The 'max_length' query parameter must be an integer.
$.paths[*][get,post,put,patch,delete].parameters[?(@.name=='max_length')].schema
error
response-200-required
Every operation must define a 200 response.
$.paths[*][get,post,put,patch,delete].responses
warn
response-description-required
Every response must include a description.
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-json-content-required
200 responses must include application/json content.
$.paths[*][get,post,put,patch,delete].responses["200"].content
info
response-error-message-field
Error response schemas should expose a 'message' field.
$.components.schemas.Error
warn
schema-snake-case-properties
Schema property names must be snake_case (matches the API's existing style).
$.components.schemas[*].properties.*~
warn
schema-description-required
Top-level schemas in components must include a description.
$.components.schemas[*]
warn
schema-type-required
Top-level schemas in components must declare a type.
$.components.schemas[*]
warn
schema-pagination-shape
Paginated list schemas must include current_page, data, per_page, total.
$.components.schemas[?(@.title && @.title.match(/List$/))]
info
security-empty-array-allowed
The Cat Facts API requires no authentication. An empty global security array is acceptable. This rule documents that decision rather than enforcing one.
$
warn
only-get-methods
The Cat Facts API is read-only. Only GET operations are allowed.
$.paths[*]
info
examples-on-operation-responses
2xx responses should include at least one named example for mock servers.
$.paths[*][get,post,put,patch,delete].responses["200"].content.application/json
info
microcks-operation-extension
Each operation should declare an x-microcks-operation block for mocking.
$.paths[*][get,post,put,patch,delete]
Spectral Ruleset
Work with this as data
Every ruleset here is available over the APIs.io API and to AI agents over MCP.