Open Trivia Database · API Governance Rules
Open Trivia Database API Rules
Spectral linting rules defining API design standards and conventions for Open Trivia Database.
36 Rules
error 12
warn 18
info 6
Rule Categories
examples
global
info
no
openapi
operation
parameter
paths
response
schema
servers
tag
Rules
warn
info-title-must-mention-open-trivia
The info.title should begin with "Open Trivia" to identify the provider.
$.info.title
error
info-description-required
A meaningful info.description is required.
$.info
warn
info-description-min-length
info.description must be at least 60 characters.
$.info.description
warn
info-license-required
A license block (CC BY-SA 4.0 for OpenTDB) must be declared.
$.info
warn
info-contact-required
A contact block must be declared so consumers can reach the provider.
$.info
warn
openapi-version-3-required
Use OpenAPI 3.0.3 (the version this repo standardizes on).
$.openapi
error
servers-required
At least one server entry must be declared.
$
error
servers-must-be-https
All server URLs must use HTTPS — opentdb.com only serves over HTTPS.
$.servers[*].url
warn
servers-must-be-opentdb
Server URL must point at https://opentdb.com.
$.servers[*].url
warn
paths-must-be-php-endpoints
All paths follow OpenTDB's documented /api*.php convention.
$.paths.*~
error
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths.*~
info
paths-snake-case-segments
Path segments use snake_case (matching api_count_global.php style).
$.paths.*~
error
operation-only-get-allowed
OpenTDB exposes only HTTP GET operations.
$.paths[*][?(@property == 'post' || @property == 'put' || @property == 'patch' || @property == 'delete' || @property == 'head' || @property == 'options' || @property == 'trace')]
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete].summary
warn
operation-summary-open-trivia-prefix
Operation summaries should start with "Open Trivia ".
$.paths[*][get].summary
warn
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete].description
error
operation-operation-id-required
Every operation must declare an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operation-id-camel-case
operationId must be camelCase (e.g. getQuestions).
$.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].tags
info
operation-must-have-microcks-extension
Operations should declare x-microcks-operation for mock-server compatibility.
$.paths[*][get,post,put,patch,delete]
warn
global-tags-required
Global tags array must be declared so each operation tag is described.
$
warn
tag-title-case
Tag names must use Title Case (e.g. Questions, Categories, Statistics).
$.tags[*].name
info
tag-description-required
Every declared tag should include a description.
$.tags[*]
warn
parameter-description-required
Every parameter must include a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
error
parameter-schema-required
Every parameter must declare a schema with a type.
$.paths[*][get,post,put,patch,delete].parameters[*]
info
parameter-snake-case
Query parameters use snake_case (matching the OpenTDB query convention).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')].name
warn
no-request-bodies-allowed
OpenTDB never uses request bodies — all input is via query parameters.
$.paths[*][get,post,put,patch,delete].requestBody
error
response-success-required
Every operation must define a 200 success response.
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
Every response must include a description.
$.paths[*][get,post,put,patch,delete].responses[*]
error
response-json-content-type
Responses must be JSON.
$.paths[*][get,post,put,patch,delete].responses[*].content
warn
response-rate-limit-documented
GET /api.php should document its 429 rate-limit response.
$.paths['/api.php'].get.responses
warn
schema-property-snake-case
Schema property names use snake_case (matching the JSON responses).
$.components.schemas[*].properties.*~
warn
schema-description-required
Every top-level component schema must include a description.
$.components.schemas[*]
error
schema-response-envelope-must-have-response-code
The shared envelope schema must include the numeric response_code field.
$.components.schemas.ResponseEnvelope.properties
info
no-security-required
OpenTDB has no authentication — no security schemes should be required.
$.security
info
examples-encouraged-on-responses
Responses should include named examples for tooling and mock servers.
$.paths[*][get,post,put,patch,delete].responses[*].content.application/json