Checkiday - National Holiday and Event API API Rules

Spectral linting rules defining API design standards and conventions for Checkiday - National Holiday and Event API.

10 Rules error 6 warn 2 info 2
View Rules File View on GitHub

Rule Categories

checkiday

Rules

error
checkiday-operation-id-camelcase
Operation IDs MUST be camelCase.
$.paths[*][*].operationId
warn
checkiday-summary-title-case
Operation summaries MUST be in Title Case.
$.paths[*][*].summary
error
checkiday-tag-required
Every operation MUST have at least one tag.
$.paths[*][*]
error
checkiday-apikey-header-auth-required
The API MUST declare an apiKey header security scheme named `apikey` (apilayer convention).
$.components.securitySchemes
error
checkiday-security-applied
Every operation MUST require the apikey security scheme.
$.paths[*][*]
warn
checkiday-rate-limit-headers
Successful responses SHOULD document `x-ratelimit-limit-month` and `x-ratelimit-remaining-month` headers.
$.paths[*][*].responses.200.headers
info
checkiday-event-id-format
Event IDs SHOULD be 32-character lowercase hexadecimal strings.
$.components.schemas.EventSummary.properties.id
error
checkiday-search-query-min-length
The `query` parameter on /search MUST enforce a minimum length of 3.
$.paths['/search'].get.parameters[?(@.name=='query')].schema
info
checkiday-snake-case-response-fields
Response object property names SHOULD use snake_case (Checkiday convention) — except rateLimit envelope.
$.components.schemas[*].properties[?(@property.match(/^[A-Z]/))]
error
checkiday-base-url-apilayer
The server URL MUST be routed through api.apilayer.com.
$.servers[*].url

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
rules:
  checkiday-operation-id-camelcase:
    description: Operation IDs MUST be camelCase.
    given: $.paths[*][*].operationId
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"
  checkiday-summary-title-case:
    description: Operation summaries MUST be in Title Case.
    given: $.paths[*][*].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9]*( [A-Z][A-Za-z0-9]*)*$"
  checkiday-tag-required:
    description: Every operation MUST have at least one tag.
    given: $.paths[*][*]
    severity: error
    then:
      field: tags
      function: truthy
  checkiday-apikey-header-auth-required:
    description: The API MUST declare an apiKey header security scheme named `apikey` (apilayer convention).
    given: $.components.securitySchemes
    severity: error
    then:
      field: apiKey
      function: truthy
  checkiday-security-applied:
    description: Every operation MUST require the apikey security scheme.
    given: $.paths[*][*]
    severity: error
    then:
      field: security
      function: truthy
  checkiday-rate-limit-headers:
    description: Successful responses SHOULD document `x-ratelimit-limit-month` and `x-ratelimit-remaining-month` headers.
    given: $.paths[*][*].responses.200.headers
    severity: warn
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required:
            - x-ratelimit-limit-month
            - x-ratelimit-remaining-month
  checkiday-event-id-format:
    description: Event IDs SHOULD be 32-character lowercase hexadecimal strings.
    given: "$.components.schemas.EventSummary.properties.id"
    severity: info
    then:
      field: pattern
      function: truthy
  checkiday-search-query-min-length:
    description: The `query` parameter on /search MUST enforce a minimum length of 3.
    given: $.paths['/search'].get.parameters[?(@.name=='query')].schema
    severity: error
    then:
      field: minLength
      function: truthy
  checkiday-snake-case-response-fields:
    description: Response object property names SHOULD use snake_case (Checkiday convention) — except rateLimit envelope.
    given: $.components.schemas[*].properties[?(@property.match(/^[A-Z]/))]
    severity: info
    then:
      function: falsy
  checkiday-base-url-apilayer:
    description: The server URL MUST be routed through api.apilayer.com.
    given: $.servers[*].url
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^https://api\\.apilayer\\.com/.*"