HipChat · API Governance Rules

HipChat API Rules

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

9 Rules error 3 warn 4 info 2
View Rules File View on GitHub

Rule Categories

hipchat

Rules

warn
hipchat-tag-titlecase
All tag names must be Title Case (e.g. "Rooms", "OAuth Sessions").
$.tags[*].name
warn
hipchat-summary-titlecase
Operation summaries must be Title Case (e.g. "Get Room Details").
$.paths[*][get,put,post,delete,patch,options,head].summary
error
hipchat-operation-id-camelcase
operationId values must be lowerCamelCase per HipChat client library naming.
$.paths[*][get,put,post,delete,patch].operationId
error
hipchat-sunset-banner
Sunset/lifecycle metadata MUST be present on info for the historical API.
$.info
error
hipchat-sunset-date-set
A sunset date MUST be recorded for the historical API.
$.info
warn
hipchat-server-list-marked-historical
At least one server should be present and marked as historical in the description.
$.servers[*].description
info
hipchat-auth-header-pattern
REST endpoints should declare security via Bearer or auth_token (HipChat conventions).
$.components.securitySchemes
info
hipchat-pagination-params
List operations should expose start-index and max-results parameters.
$.paths[?(@property.match(/^\/(room|user|emoticon)$/))].get.parameters[*].name
warn
hipchat-room-path-uses-id-or-name
Room endpoints should accept the id_or_name path parameter convention.
$.paths[?(@property.match(/^\/room\//))]

Spectral Ruleset

Raw ↑
extends: ["spectral:oas"]
rules:
  hipchat-tag-titlecase:
    description: All tag names must be Title Case (e.g. "Rooms", "OAuth Sessions").
    message: "Tag '{{value}}' should be Title Case."
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9]*( [A-Z][A-Za-z0-9]*)*$"
  hipchat-summary-titlecase:
    description: Operation summaries must be Title Case (e.g. "Get Room Details").
    message: "Operation summary '{{value}}' should be Title Case."
    severity: warn
    given: "$.paths[*][get,put,post,delete,patch,options,head].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"
  hipchat-operation-id-camelcase:
    description: operationId values must be lowerCamelCase per HipChat client library naming.
    message: "operationId '{{value}}' should be lowerCamelCase."
    severity: error
    given: "$.paths[*][get,put,post,delete,patch].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"
  hipchat-sunset-banner:
    description: Sunset/lifecycle metadata MUST be present on info for the historical API.
    message: "info.x-status must be set; HipChat is a sunset surface."
    severity: error
    given: "$.info"
    then:
      field: x-status
      function: truthy
  hipchat-sunset-date-set:
    description: A sunset date MUST be recorded for the historical API.
    severity: error
    given: "$.info"
    then:
      field: x-sunset-date
      function: truthy
  hipchat-server-list-marked-historical:
    description: At least one server should be present and marked as historical in the description.
    severity: warn
    given: "$.servers[*].description"
    then:
      function: pattern
      functionOptions:
        match: "(historical|no longer|sunset|discontinued)"
  hipchat-auth-header-pattern:
    description: REST endpoints should declare security via Bearer or auth_token (HipChat conventions).
    severity: info
    given: "$.components.securitySchemes"
    then:
      function: truthy
  hipchat-pagination-params:
    description: List operations should expose start-index and max-results parameters.
    severity: info
    given: "$.paths[?(@property.match(/^\\/(room|user|emoticon)$/))].get.parameters[*].name"
    then:
      function: enumeration
      functionOptions:
        values: [start-index, max-results, include-private, include-archived, include-guests, include-deleted, type]
  hipchat-room-path-uses-id-or-name:
    description: Room endpoints should accept the id_or_name path parameter convention.
    severity: warn
    given: "$.paths[?(@property.match(/^\\/room\\//))]"
    then:
      function: truthy