Spectral linting rules defining API design standards and conventions for Wikipedia / MediaWiki.
29 Ruleserror 8warn 16info 5
Generated by API Evangelist
Written by API Evangelist tooling for Wikipedia / MediaWiki's APIs. It is a starting point, not a ruleset Wikipedia / MediaWiki publishes or enforces.
# authorship: generated by API Evangelist tooling. Stamped 2026-08-18
# on the file's own generator header (roadmap#64). An unmarked file is
# NOT assumed to be ours -- absence of evidence was never stamped.
x-method: generated
# wikipedia — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
# - servers-https-only: 100% of servers already https (error)
# - path-params-casing: snake @ 100% (n=128)
# - query-params-casing: snake @ 100% (n=81)
# - operationid-casing: camel @ 88% (n=34)
# - schema-names-casing: snake @ 77% (n=83)
# - schema-properties-casing: snake @ 98% (n=376)
# - security: global (root) — NOT emitting operation-security-required
# - error-schema-defined: ActionApiError
# - pagination params observed: ['count', 'limit']
# - merge: kept 25 existing, added 5 measured, upgraded 0
# - added: query-params-casing, operationid-casing, schema-names-casing, security-schemes-defined, error-schema-defined
extends:
- spectral:oas
rules:
info-title-prefix:
description: Spec title should begin with "Wikipedia", "MediaWiki", "Wikimedia", or "Wikidata".
message: 'info.title should start with one of: Wikipedia, MediaWiki, Wikimedia, Wikidata.'
given: $.info
severity: warn
then:
field: title
function: pattern
functionOptions:
match: ^(Wikipedia|MediaWiki|Wikimedia|Wikidata)\b
info-description-required:
description: info.description must be present and non-trivial.
given: $.info
severity: error
then:
field: description
function: truthy
info-license-required:
description: info.license must be defined (CC BY-SA, CC0, or commercial).
given: $.info
severity: warn
then:
field: license
function: truthy
openapi-version-3:
description: OpenAPI version must be 3.x.
given: $.openapi
severity: error
then:
function: pattern
functionOptions:
match: ^3\.
servers-required:
description: At least one server must be declared.
given: $
severity: error
then:
field: servers
function: truthy
server-https:
description: Servers must use https://.
given: $.servers[*].url
severity: warn
then:
function: pattern
functionOptions:
match: ^https://
path-no-trailing-slash:
description: Paths should not end with a trailing slash.
given: $.paths
severity: warn
then:
field: '@key'
function: pattern
functionOptions:
notMatch: .+/$
path-snake-or-kebab:
description: Path segments should use snake_case or kebab-case (lowercase, digits, dashes, underscores,
or templated params).
given: $.paths
severity: warn
then:
field: '@key'
function: pattern
functionOptions:
match: ^(/[a-z0-9_\-]+|/\{[A-Za-z_]+\})+$|^/$|^/api\.php$|^/sparql$
operation-operationid-required:
description: Every operation must have a camelCase operationId.
given: $.paths[*][get,post,put,patch,delete]
severity: error
then:
- field: operationId
function: truthy
- field: operationId
function: pattern
functionOptions:
match: ^[a-z][a-zA-Z0-9]*$
operation-summary-required:
description: Every operation must have a summary in Title Case prefixed with the provider name.
given: $.paths[*][get,post,put,patch,delete]
severity: error
then:
field: summary
function: truthy
operation-description-required:
description: Every operation must have a description.
given: $.paths[*][get,post,put,patch,delete]
severity: warn
then:
field: description
function: truthy
operation-tags-required:
description: Every operation must have at least one tag.
given: $.paths[*][get,post,put,patch,delete]
severity: warn
then:
field: tags
function: truthy
operation-microcks-extension:
description: Every operation should declare x-microcks-operation for mock-server compatibility.
given: $.paths[*][get,post,put,patch,delete]
severity: info
then:
field: x-microcks-operation
function: truthy
tags-title-case:
description: Tag names should be Title Case (multi-word) or PascalCase.
given: $.tags[*].name
severity: info
then:
function: pattern
functionOptions:
match: ^[A-Z][A-Za-z0-9 ]*$
parameter-description-required:
description: Every parameter should have a description.
given: $.paths[*][*].parameters[*]
severity: warn
then:
field: description
function: truthy
parameter-schema-required:
description: Every parameter must have a schema with a type.
given: $.paths[*][*].parameters[*]
severity: error
then:
field: schema
function: truthy
parameter-snake-case:
description: Query and path parameters should use snake_case.
given: $.paths[*][*].parameters[?(@.in=='query' || @.in=='path')]
severity: info
then:
field: name
function: pattern
functionOptions:
match: ^[a-z][a-z0-9_]*$|^[A-Z][A-Za-z]+$
request-body-content-required:
description: Request bodies must declare a content media type.
given: $.paths[*][post,put,patch].requestBody
severity: error
then:
field: content
function: truthy
response-success-required:
description: Every operation must declare at least one 2xx response.
given: $.paths[*][get,post,put,patch,delete].responses
severity: error
then:
function: truthy
response-description-required:
description: Every response must have a description.
given: $.paths[*][*].responses[*]
severity: warn
then:
field: description
function: truthy
schema-property-snake-case:
description: Schema properties should use snake_case (MediaWiki convention).
given: $.components.schemas[*].properties
severity: info
then:
field: '@key'
function: pattern
functionOptions:
match: ^[a-z][a-z0-9_]*$|^\*$|^[A-Z][A-Za-z]*$|^[a-z][a-zA-Z0-9]*$|^xml:lang$
schema-type-required:
description: Each top-level component schema should declare a type.
given: $.components.schemas[*]
severity: warn
then:
field: type
function: truthy
security-schemes-defined:
description: Security schemes should be defined in components.
severity: warn
given: $.components
then:
field: securitySchemes
function: truthy
no-empty-description:
description: Descriptions must not be empty when present.
given: $..description
severity: warn
then:
function: truthy
user-agent-required-note:
description: API description should mention contactable User-Agent requirement (Wikimedia policy).
given: $.info
severity: info
then:
field: description
function: pattern
functionOptions:
match: (?i)User[- ]Agent
query-params-casing:
description: Query parameters should be snake_case (the dominant convention in this API).
severity: warn
given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
then:
field: name
function: casing
functionOptions:
type: snake
operationid-casing:
description: Operation IDs should be camelCase (the dominant convention in this API).
severity: warn
given: $.paths[*][get,post,put,patch,delete].operationId
then:
function: casing
functionOptions:
type: camel
schema-names-casing:
description: Component schema names should be snake_case (the dominant convention in this API).
severity: warn
given: $.components.schemas
then:
field: '@key'
function: casing
functionOptions:
type: snake
error-schema-defined:
description: A shared error schema (ActionApiError) should be defined for error payloads.
severity: warn
given: $.components.schemas
then:
field: ActionApiError
function: truthy
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.