StatsD · API Governance Rules

StatsD API Rules

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

StatsD API Rules is a Spectral governance ruleset published by StatsD on the APIs.io network, containing 7 lint rules.

The ruleset includes 1 error-severity rule, 4 warning-severity rules, and 2 info-severity rules.

Tagged areas include Aggregation, Daemon, DogStatsD, Line Protocol, and Metrics.

Rulesets can be applied to your own OpenAPI specs via Spectral to enforce the same governance standards.

7 Rules error 1 warn 4 info 2
View Rules File View on GitHub

Rule Categories

statsd

Rules

warn
statsd-summary-title-case
Every operation summary MUST be in Title Case.
$.paths[*][*].summary
error
statsd-operation-description-required
Every operation MUST have a description.
$.paths[*][get,post,put,delete,patch]
warn
statsd-operation-id-camel-case
operationId MUST be lowerCamelCase.
$.paths[*][*].operationId
warn
statsd-tag-defined-titlecase
All tags MUST be defined in the top-level `tags` array and use Title Case.
$.tags[*].name
info
statsd-admin-text-plain-responses
The StatsD admin interface returns plain-text payloads natively. Every 2xx response in the admin OpenAPI MUST advertise a `text/plain` media type (even when also exposing JSON-shaped schemas for parsed consumers).
$.paths[*][get,post].responses['200'].content
info
statsd-admin-default-port-documented
The admin TCP port SHOULD be exposed as a server variable with default 8126.
$.servers[*].variables.port
warn
statsd-no-trailing-slash
Paths MUST NOT end with a trailing slash.
$.paths

Spectral Ruleset

Raw ↑
extends:
- - spectral:oas
  - all
rules:
  statsd-summary-title-case:
    description: Every operation summary MUST be in Title Case.
    severity: warn
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: '^(?:[A-Z][A-Za-z0-9]*)(?: [A-Z][A-Za-z0-9]*)*$'

  statsd-operation-description-required:
    description: Every operation MUST have a description.
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: description
      function: truthy

  statsd-operation-id-camel-case:
    description: operationId MUST be lowerCamelCase.
    severity: warn
    given: $.paths[*][*].operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]*$'

  statsd-tag-defined-titlecase:
    description: All tags MUST be defined in the top-level `tags` array and use Title Case.
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: '^(?:[A-Z][A-Za-z0-9]*)(?: [A-Z][A-Za-z0-9]*)*$'

  statsd-admin-text-plain-responses:
    description: >-
      The StatsD admin interface returns plain-text payloads natively. Every
      2xx response in the admin OpenAPI MUST advertise a `text/plain` media
      type (even when also exposing JSON-shaped schemas for parsed consumers).
    severity: info
    given: $.paths[*][get,post].responses['200'].content
    then:
      field: text/plain
      function: truthy

  statsd-admin-default-port-documented:
    description: The admin TCP port SHOULD be exposed as a server variable with default 8126.
    severity: info
    given: $.servers[*].variables.port
    then:
      field: default
      function: truthy

  statsd-no-trailing-slash:
    description: Paths MUST NOT end with a trailing slash.
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        notMatch: '.+/$'
      field: '@key'