CoreDNS · API Governance Rules

CoreDNS API Rules

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

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

Rule Categories

coredns

Rules

error
coredns-health-info-license
API info object should include Apache 2.0 license.
$.info.license
warn
coredns-health-server-localhost
Servers should reference the localhost CoreDNS health endpoint.
$.servers[*].url
error
coredns-health-paths
API must define /health and /ready paths.
$.paths
error
coredns-health-get-only
Health and readiness endpoints must only support GET.
$.paths['/health','/ready']
warn
coredns-health-text-plain-response
Health and readiness 200 responses should return text/plain.
$.paths['/health','/ready'].get.responses.200.content
error
coredns-health-503-response
Health and readiness endpoints should document 503 responses.
$.paths['/health','/ready'].get.responses
error
coredns-health-operation-id
Operations must define an operationId.
$.paths.*.get
error
coredns-health-tags
Operations must define tags.
$.paths.*.get

Spectral Ruleset

Raw ↑
extends: ["spectral:oas"]
documentationUrl: https://coredns.io/plugins/health/
rules:
  coredns-health-info-license:
    description: API info object should include Apache 2.0 license.
    given: "$.info.license"
    severity: error
    then:
      field: name
      function: pattern
      functionOptions:
        match: "Apache"
  coredns-health-server-localhost:
    description: Servers should reference the localhost CoreDNS health endpoint.
    given: "$.servers[*].url"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "localhost"
  coredns-health-paths:
    description: API must define /health and /ready paths.
    given: "$.paths"
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required:
            - /health
            - /ready
  coredns-health-get-only:
    description: Health and readiness endpoints must only support GET.
    given: "$.paths['/health','/ready']"
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            get:
              type: object
          additionalProperties: false
  coredns-health-text-plain-response:
    description: Health and readiness 200 responses should return text/plain.
    given: "$.paths['/health','/ready'].get.responses.200.content"
    severity: warn
    then:
      field: text/plain
      function: truthy
  coredns-health-503-response:
    description: Health and readiness endpoints should document 503 responses.
    given: "$.paths['/health','/ready'].get.responses"
    severity: error
    then:
      field: '503'
      function: truthy
  coredns-health-operation-id:
    description: Operations must define an operationId.
    given: "$.paths.*.get"
    severity: error
    then:
      field: operationId
      function: truthy
  coredns-health-tags:
    description: Operations must define tags.
    given: "$.paths.*.get"
    severity: error
    then:
      field: tags
      function: truthy