JokeAPI · API Governance Rules
JokeAPI API Rules
Spectral linting rules defining API design standards and conventions for JokeAPI.
46 Rules
error 15
warn 21
info 10
Rule Categories
error
examples
get
info
no
openapi
operation
parameter
path
post
query
request
response
schema
server
servers
tag
tags
Rules
error
info-title-jokeapi
info.title MUST be "JokeAPI" (the canonical product name).
$.info
error
info-description-required
info.description MUST be present with at least 80 characters.
$.info
error
info-version-required
info.version MUST be present and follow semver.
$.info
warn
info-license-mit
License MUST be declared as MIT (JokeAPI is MIT-licensed).
$.info.license
info
info-contact-required
Contact information SHOULD be present.
$.info
warn
openapi-version-3-0
Use OpenAPI 3.0.x — Microcks and tooling compatibility.
$.openapi
error
servers-required
servers MUST be defined and non-empty.
$
error
server-url-https
Every server URL MUST use HTTPS.
$.servers[*].url
info
server-canonical-host
At least one server URL SHOULD point at v2.jokeapi.dev.
$
warn
path-kebab-case
Path segments MUST be lowercase kebab-case.
$.paths.*~
error
path-no-trailing-slash
Paths MUST NOT end with a trailing slash.
$.paths.*~
error
path-no-query-string
Paths MUST NOT contain a query string.
$.paths.*~
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.
$.paths.*[get,post,put,patch,delete].operationId
error
operation-summary-required
Every operation MUST have a summary.
$.paths.*[get,post,put,patch,delete]
warn
operation-summary-jokeapi-prefix
Operation summary MUST start with "JokeAPI ".
$.paths.*[get,post,put,patch,delete].summary
warn
operation-description-required
Every operation MUST have a description of at least 30 characters.
$.paths.*[get,post,put,patch,delete]
error
operation-tags-required
Every operation MUST be tagged.
$.paths.*[get,post,put,patch,delete]
info
operation-microcks-extension
Every operation SHOULD declare an x-microcks-operation extension.
$.paths.*[get,post,put,patch,delete]
warn
tags-global-defined
Global tags array MUST be defined.
$
warn
tag-title-case
Tag names MUST be Title Case (e.g. "Jokes", "Metadata", "System").
$.tags[*].name
warn
tag-description-required
Every global tag MUST have a description.
$.tags[*]
warn
parameter-description-required
Every parameter MUST have a description.
$.paths.*.*.parameters[*]
error
parameter-schema-required
Every parameter MUST have a schema with type.
$.paths.*.*.parameters[*]
warn
parameter-camel-or-kebab-case
Parameter names follow JokeAPI's actual convention — camelCase (`blacklistFlags`, `idRange`) or kebab-case (`safe-mode`).
$.paths.*.*.parameters[*].name
info
parameter-format-enum
`format` parameter SHOULD declare its enum [json, xml, yaml, txt].
$.paths.*.*.parameters[?(@.name=='format')]
warn
request-body-json-content
Request bodies MUST advertise application/json content.
$.paths.*.*.requestBody.content
info
request-body-description
Request bodies SHOULD have a description.
$.paths.*.*.requestBody
error
response-2xx-required
Every operation MUST document at least one 2xx response.
$.paths.*[get,post,put,patch,delete].responses
info
response-429-documented
Operations SHOULD document a 429 response (JokeAPI rate-limits at 120 req/min).
$.paths.*[get,post,put,patch,delete].responses
error
response-description-required
Every response MUST have a description.
$.paths.*.*.responses.*
info
response-json-content
Responses SHOULD include application/json content.
$.paths.*.*.responses.*.content
warn
schema-description-required
Top-level component schemas MUST have a description.
$.components.schemas.*
error
schema-type-required
Top-level component schemas MUST declare a type.
$.components.schemas.*
info
schema-property-camel-case
Schema property names use the same casing as the live API (camelCase or single-word lowercase).
$.components.schemas.*.properties.*~
warn
schema-error-envelope
JokeAPI error responses follow the `{error, code, message, causedBy, timestamp}` envelope.
$.components.schemas.JokeError
warn
schema-timestamp-integer
`timestamp` properties MUST be `integer` (Unix epoch milliseconds).
$..properties.timestamp
warn
no-security-schemes
JokeAPI requires NO authentication — security schemes MUST NOT be declared.
$.components
error
get-no-request-body
GET operations MUST NOT have a request body.
$.paths.*.get
warn
post-has-request-body
POST operations SHOULD declare a request body.
$.paths.*.post
warn
no-empty-descriptions
Descriptions MUST NOT be empty whitespace.
$..description
info
examples-on-schemas
Schema properties SHOULD carry examples to power Microcks mocks.
$.components.schemas.*.properties.*
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (JokeError) should be defined for error payloads.
$.components.schemas