systemd · API Governance Rules

systemd API Rules

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

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

The ruleset includes 3 error-severity rules, 4 warning-severity rules, and 1 hint-severity rule.

Tagged areas include Boot, Cgroups, Container, D-Bus, and Init.

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

8 Rules error 3 warn 4
View Rules File View on GitHub

Rule Categories

systemd

Rules

error
systemd-operationid-pascalcase
operationId must use PascalCase, matching the D-Bus method name (e.g. StartUnit, ListSessions, SetLinkDNS).
$.paths[*][*]
warn
systemd-summary-title-case
Operation summaries must be in Title Case.
$.paths[*][*].summary
error
systemd-summary-required
Every operation must declare a summary.
$.paths[*][*]
warn
systemd-description-required
Every operation must declare a description that names the underlying D-Bus or Varlink method (use the word "Mirrors" for D-Bus, "Calls" for Varlink).
$.paths[*][*]
error
systemd-server-transport
Server URL must use one of the systemd transport schemes (dbus://, varlink://).
$.servers[*].url
warn
systemd-tags-title-case
Tag names must be in Title Case (matching the network-wide convention).
$.tags[*].name
hint
systemd-info-contact
info.contact should be present for traceability.
$.info
warn
systemd-license-lgpl-or-gpl
License must be LGPL-2.1-or-later or GPL-2.0-or-later (systemd's dual licensing).
$.info.license.name

Spectral Ruleset

Raw ↑
extends: [["spectral:oas", "all"]]
documentationUrl: https://raw.githubusercontent.com/api-evangelist/systemd/refs/heads/main/rules/systemd-rules.yml
description: |
  Spectral ruleset enforcing the conventions used by the OpenAPI documents in this systemd profile.
  These specs model D-Bus and Varlink interfaces as REST operations, so the rules center on naming
  consistency, Title Case summaries, presence of bus/socket information in description, and the
  use of explicit operationIds matching the underlying D-Bus method name.
rules:
  systemd-operationid-pascalcase:
    description: operationId must use PascalCase, matching the D-Bus method name (e.g. StartUnit, ListSessions, SetLinkDNS).
    given: $.paths[*][*]
    severity: error
    then:
      field: operationId
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9]+$"
  systemd-summary-title-case:
    description: Operation summaries must be in Title Case.
    given: $.paths[*][*].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z0-9][A-Za-z0-9-]*\\s*)+$"
  systemd-summary-required:
    description: Every operation must declare a summary.
    given: $.paths[*][*]
    severity: error
    then:
      field: summary
      function: truthy
  systemd-description-required:
    description: Every operation must declare a description that names the underlying D-Bus or Varlink method (use the word "Mirrors" for D-Bus, "Calls" for Varlink).
    given: $.paths[*][*]
    severity: warn
    then:
      field: description
      function: truthy
  systemd-server-transport:
    description: Server URL must use one of the systemd transport schemes (dbus://, varlink://).
    given: $.servers[*].url
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^(dbus|varlink)://"
  systemd-tags-title-case:
    description: Tag names must be in Title Case (matching the network-wide convention).
    given: $.tags[*].name
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][A-Za-z0-9-]*\\s*)+$"
  systemd-info-contact:
    description: info.contact should be present for traceability.
    given: $.info
    severity: hint
    then:
      field: contact
      function: truthy
  systemd-license-lgpl-or-gpl:
    description: License must be LGPL-2.1-or-later or GPL-2.0-or-later (systemd's dual licensing).
    given: $.info.license.name
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^(LGPL-2\\.1-or-later|GPL-2\\.0-or-later)$"