AccuWeather · API Governance Rules

AccuWeather API Rules

Spectral linting rules defining API design standards and conventions for AccuWeather.

29 Rules error 11 warn 14 info 4
View Rules File View on GitHub

Rule Categories

delete get info no openapi operation parameter path paths query response schema security servers

Rules

warn
info-title-format
$.info.title
error
info-description-required
$.info
error
info-version-required
$.info
error
openapi-version-3
$
error
servers-defined
$
error
servers-https-only
$.servers[*].url
warn
paths-kebab-case
$.paths[*]~
warn
paths-no-trailing-slash
$.paths[*]~
error
operation-summary-required
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-starts-with-accuweather
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
$.paths[*][get,post,put,patch,delete]
warn
operation-tags-required
$.paths[*][get,post,put,patch,delete]
error
operation-id-required
$.paths[*][get,post,put,patch,delete]
warn
parameter-description-required
$.paths[*][*].parameters[*]
error
parameter-schema-required
$.paths[*][*].parameters[*]
error
response-success-required
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
$.paths[*][*].responses[*]
info
response-error-401
$.paths[*][get,post,put,patch,delete].responses
info
schema-properties-described
$.components.schemas[*].properties[*]
warn
schema-type-defined
$.components.schemas[*].properties[*]
warn
security-schemes-defined
$.components
error
get-no-request-body
$.paths[*].get
warn
delete-no-request-body
$.paths[*].delete
info
operation-examples-encouraged
$.paths[*][get,post,put,patch,delete].responses[*].content[*]
warn
path-params-casing
Path parameters should be camelCase (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be PascalCase (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 camelCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# 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