WeatherAPI · API Governance Rules
WeatherAPI API Rules
Spectral linting rules defining API design standards and conventions for WeatherAPI.
37 Rules
error 11
warn 21
info 5
Rule Categories
examples
get
info
no
openapi
operation
parameter
paths
requestbody
response
schema
security
servers
tags
Rules
warn
info-title-format
Info title should begin with "WeatherAPI" to match the provider naming convention.
$.info.title
error
info-description-required
Info description must be present and substantive (>= 80 chars).
$.info
error
info-version-required
A SemVer-ish version is required on info.
$.info
info
info-contact-recommended
Provide a contact block so consumers can reach support.
$.info
info
info-license-recommended
Provide a license so consumers can understand reuse terms.
$.info
warn
openapi-version-3-1
Use OpenAPI 3.1.x (matches the official WeatherAPI.com spec).
$.openapi
error
servers-defined
At least one server URL must be defined.
$
warn
servers-https-required
HTTPS server URL must be present (https://api.weatherapi.com/v1).
$.servers[*].url
warn
paths-json-suffix
WeatherAPI paths use the `.json` suffix (legacy XML variants live at the same root).
$.paths.*~
warn
paths-lowercase-segments
Path segments must be lowercase (no camelCase or PascalCase).
$.paths.*~
error
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths.*~
error
operation-operationid-required
Every operation must declare an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-camelcase
WeatherAPI operationIds are camelCase (e.g. getCurrentWeather, ipLookup, searchLocations).
$.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-weatherapi-prefix
Operation summaries should be prefixed with "WeatherAPI" so they identify the provider in catalog UIs.
$.paths[*][get,post,put,patch,delete].summary
error
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-tags-required
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
info
operation-microcks-extension
Each operation should expose `x-microcks-operation` so it can be mocked via Microcks.
$.paths[*][get,post,put,patch,delete]
warn
tags-title-case
Global tags must use Title Case (Weather, History, Marine, Future, Geo, Sports, Alerts).
$.tags[*].name
warn
tags-description-required
Each global tag should have a description.
$.tags[*]
warn
parameter-description-required
Every parameter must have a description.
$.components.parameters[*]
warn
parameter-snake-case
WeatherAPI query parameters use snake_case (e.g. end_dt, current_fields, q, dt).
$.components.parameters[*].name
info
parameter-q-required-on-data-endpoints
Every data-returning operation should accept the `q` location parameter (except internal/bulk variants).
$.paths[*][get]
error
response-200-required
Every GET operation must define a 200 response.
$.paths[*][get].responses
warn
response-400-required
Define a 400 response for client errors (matches the WeatherAPI ErrorResponse shape).
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-required
Define a 401 response for missing/invalid API keys.
$.paths[*][get,post,put,patch,delete].responses
warn
response-403-required
Define a 403 response for plan/quota or geographic restrictions.
$.paths[*][get,post,put,patch,delete].responses
warn
response-json-content
Responses must use application/json content type (WeatherAPI also offers XML, but JSON is canonical).
$.paths[*][get,post,put,patch,delete].responses[*].content
warn
requestbody-json-content
Request bodies should declare application/json content.
$.paths[*][post,put,patch].requestBody.content
warn
schema-property-snake-case
Schema properties use snake_case (temp_c, last_updated, wind_kph, feelslike_c).
$.components.schemas[*].properties[*]~
warn
schema-description-required
Top-level component schemas should have a description.
$.components.schemas[*]
warn
schema-type-required
Top-level schemas with properties should declare a type.
$.components.schemas[?(@.properties)]
error
security-defined
A global security requirement must be declared.
$
warn
security-apikey-scheme
WeatherAPI uses a single ApiKeyAuth security scheme via the `key` query parameter.
$.components.securitySchemes.ApiKeyAuth
error
get-no-request-body
GET operations must not declare a request body.
$.paths[*][get]
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description
info
examples-encouraged
Schema properties should provide an example value where realistic.
$.components.schemas[*].properties[*]