Calendarific · API Governance Rules

Calendarific API Rules

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

6 Rules error 2 warn 4
View Rules File View on GitHub

Rule Categories

calendarific

Rules

warn
calendarific-operation-id-camel-case
All operationId values should use camelCase.
$.paths[*][get,post,put,delete,patch].operationId
warn
calendarific-operation-summary-title-case
Operation summaries should use Title Case.
$.paths[*][get,post,put,delete,patch].summary
error
calendarific-api-key-required
All operations must require an api_key query parameter (Calendarific auth model).
$.paths[*][get]
error
calendarific-tag-defined
Every operation must have at least one tag (Holidays, Countries, Languages).
$.paths[*][get,post,put,delete,patch]
warn
calendarific-response-envelope
200 responses should reference a schema (response envelope with meta + response).
$.paths[*][get].responses['200'].content['application/json']
warn
calendarific-rate-limit-documented
Operations should document 429 rate-limit responses.
$.paths[*][get].responses

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
documentationUrl: https://calendarific.com/api-documentation
rules:
  calendarific-operation-id-camel-case:
    description: All operationId values should use camelCase.
    message: "{{property}} should be camelCase"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"
  calendarific-operation-summary-title-case:
    description: Operation summaries should use Title Case.
    message: "{{property}}: {{value}} should be Title Case"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].summary"
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-zA-Z0-9]*)(\\s[A-Z][a-zA-Z0-9]*)*$"
  calendarific-api-key-required:
    description: All operations must require an api_key query parameter (Calendarific auth model).
    message: "Operation must require api_key query parameter"
    severity: error
    given: "$.paths[*][get]"
    then:
      field: parameters
      function: truthy
  calendarific-tag-defined:
    description: Every operation must have at least one tag (Holidays, Countries, Languages).
    message: "Operation must declare a tag"
    severity: error
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: tags
      function: truthy
  calendarific-response-envelope:
    description: 200 responses should reference a schema (response envelope with meta + response).
    message: "200 response should have a referenced schema"
    severity: warn
    given: "$.paths[*][get].responses['200'].content['application/json']"
    then:
      field: schema
      function: truthy
  calendarific-rate-limit-documented:
    description: Operations should document 429 rate-limit responses.
    message: "Operation should document 429 response"
    severity: warn
    given: "$.paths[*][get].responses"
    then:
      field: "429"
      function: truthy