100ms · API Governance Rules

100ms API Rules

Spectral linting rules defining API design standards and conventions for 100ms.

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

Rule Categories

hms

Rules

error
hms-paths-must-be-lower-kebab
100ms paths must be lower-kebab-case (e.g. /live-streams, /room-codes).
$.paths[*]~
error
hms-operation-id-camel-case
100ms operationIds use camelCase (e.g. createRoom, startLiveStreamForRoom).
$.paths[*][get,post,put,patch,delete].operationId
warn
hms-summary-title-case
Operation summary must be Title Case.
$.paths[*][get,post,put,patch,delete].summary
error
hms-operation-tagged
All operations must be tagged for grouping in the docs.
$.paths[*][get,post,put,patch,delete]
warn
hms-bearer-security-everywhere
Every operation must inherit the ManagementToken bearer scheme.
$
error
hms-path-params-snake-case
Path parameters use snake_case (room_id, template_id, recording_id, peer_id).
$.paths[*]~
warn
hms-schemas-pascal-case
Schemas use PascalCase names.
$.components.schemas[*]~

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, recommended]]
documentationUrl: https://www.100ms.live/docs/server-side/v2/foundation/basics
rules:
  # 100ms uses singular "v2" base path and resource paths in lower-kebab.
  hms-paths-must-be-lower-kebab:
    description: 100ms paths must be lower-kebab-case (e.g. /live-streams, /room-codes).
    severity: error
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: '^/[a-z0-9-]+(?:/\{[a-z_]+\}|/[a-z0-9-]+)*$'

  # operationIds use camelCase per the dashboard / Postman naming convention.
  hms-operation-id-camel-case:
    description: 100ms operationIds use camelCase (e.g. createRoom, startLiveStreamForRoom).
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'

  # Summaries must be Title Case (Generator standard for api-evangelist).
  hms-summary-title-case:
    description: Operation summary must be Title Case.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][a-zA-Z0-9]*)( [A-Z][a-zA-Z0-9]*)*$'

  # Every operation must declare at least one tag.
  hms-operation-tagged:
    description: All operations must be tagged for grouping in the docs.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  # Every endpoint requires the management JWT (Bearer).
  hms-bearer-security-everywhere:
    description: Every operation must inherit the ManagementToken bearer scheme.
    severity: warn
    given: "$"
    then:
      field: security
      function: truthy

  # IDs in path use snake_case ({room_id}, {template_id}, ...).
  hms-path-params-snake-case:
    description: Path parameters use snake_case (room_id, template_id, recording_id, peer_id).
    severity: error
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        notMatch: '\{[A-Z]'

  # Schemas must be PascalCase.
  hms-schemas-pascal-case:
    description: Schemas use PascalCase names.
    severity: warn
    given: "$.components.schemas[*]~"
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][a-zA-Z0-9]+$'