# accuweather — 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:
# - path-params-casing: camel @ 94% (n=17)
# - query-params-casing: pascal @ 86% (n=118)
# - schema-names-casing: pascal @ 100% (n=57)
# - schema-properties-casing: camel @ 51% (n=349)
# - pagination params observed: ['page']
# - merge: kept 24 existing, added 5 measured, upgraded 0
# - added: path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, no-empty-descriptions
extends:
- spectral:oas
rules:
info-title-format:
message: API title should start with "AccuWeather"
severity: warn
given: $.info.title
then:
function: pattern
functionOptions:
match: ^AccuWeather
info-description-required:
message: API info must have a non-empty description
severity: error
given: $.info
then:
field: description
function: truthy
info-version-required:
message: API info must include a version
severity: error
given: $.info
then:
field: version
function: truthy
openapi-version-3:
message: Must use OpenAPI 3.x
severity: error
given: $
then:
field: openapi
function: pattern
functionOptions:
match: ^3\.
servers-defined:
message: At least one server must be defined
severity: error
given: $
then:
field: servers
function: truthy
servers-https-only:
message: All server URLs must use HTTPS
severity: error
given: $.servers[*].url
then:
function: pattern
functionOptions:
match: ^https://
paths-kebab-case:
message: Path segments should use kebab-case
severity: warn
given: $.paths[*]~
then:
function: pattern
functionOptions:
match: ^(/[a-z0-9{}-]+)+$
paths-no-trailing-slash:
message: Paths should not have trailing slashes
severity: warn
given: $.paths[*]~
then:
function: pattern
functionOptions:
notMatch: /$
operation-summary-required:
message: All operations must have a summary
severity: error
given: $.paths[*][get,post,put,patch,delete]
then:
field: summary
function: truthy
operation-summary-starts-with-accuweather:
message: Operation summaries should start with "AccuWeather"
severity: warn
given: $.paths[*][get,post,put,patch,delete].summary
then:
function: pattern
functionOptions:
match: ^AccuWeather
operation-description-required:
message: All operations should have a description
severity: warn
given: $.paths[*][get,post,put,patch,delete]
then:
field: description
function: truthy
operation-tags-required:
message: All operations must have at least one tag
severity: warn
given: $.paths[*][get,post,put,patch,delete]
then:
field: tags
function: truthy
operation-id-required:
message: All operations must have an operationId
severity: error
given: $.paths[*][get,post,put,patch,delete]
then:
field: operationId
function: truthy
parameter-description-required:
message: All parameters must have a description
severity: warn
given: $.paths[*][*].parameters[*]
then:
field: description
function: truthy
parameter-schema-required:
message: All parameters must have a schema
severity: error
given: $.paths[*][*].parameters[*]
then:
field: schema
function: truthy
response-success-required:
message: All operations must have at least one 2xx response
severity: error
given: $.paths[*][get,post,put,patch,delete].responses
then:
function: schema
functionOptions:
schema:
type: object
anyOf:
- required:
- '200'
- required:
- '201'
- required:
- '204'
response-description-required:
message: All responses must have a description
severity: error
given: $.paths[*][*].responses[*]
then:
field: description
function: truthy
response-error-401:
message: Protected operations should include a 401 response
severity: info
given: $.paths[*][get,post,put,patch,delete].responses
then:
function: schema
functionOptions:
schema:
type: object
required:
- '401'
schema-properties-described:
message: Schema properties should have descriptions
severity: info
given: $.components.schemas[*].properties[*]
then:
field: description
function: truthy
schema-type-defined:
message: All schema properties should have a type defined
severity: warn
given: $.components.schemas[*].properties[*]
then:
field: type
function: truthy
security-schemes-defined:
message: Security schemes should be defined in components
severity: warn
given: $.components
then:
field: securitySchemes
function: truthy
get-no-request-body:
message: GET operations must not have a request body
severity: error
given: $.paths[*].get
then:
field: requestBody
function: falsy
delete-no-request-body:
message: DELETE operations should not have a request body
severity: warn
given: $.paths[*].delete
then:
field: requestBody
function: falsy
operation-examples-encouraged:
message: Operations should include examples for mock server compatibility
severity: info
given: $.paths[*][get,post,put,patch,delete].responses[*].content[*]
then:
function: schema
functionOptions:
schema:
anyOf:
- required:
- example
- required:
- examples
path-params-casing:
description: Path parameters should be camelCase (the dominant convention in this API).
severity: warn
given: $.paths[*].parameters[?(@.in=='path')].name
then:
function: casing
functionOptions:
type: camel
query-params-casing:
description: Query parameters should be PascalCase (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: pascal
schema-names-casing:
description: Component schema names should be PascalCase (the dominant convention in this API).
severity: warn
given: $.components.schemas
then:
field: '@key'
function: pattern
functionOptions:
match: ^[A-Z][A-Za-z0-9]*$
schema-properties-casing:
description: Schema properties should be camelCase (the dominant convention in this API).
severity: info
given: $.components.schemas[*].properties
then:
field: '@key'
function: pattern
functionOptions:
match: ^[a-z][A-Za-z0-9]*$
no-empty-descriptions:
description: Descriptions must not be empty strings.
severity: warn
given: $..description
then:
function: truthy