CloudBees · API Governance Rules

CloudBees API Rules

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

12 Rules error 4 warn 6 info 2
View Rules File View on GitHub

Rule Categories

cloudbees

Rules

error
cloudbees-info-contact
API contact information must be present.
$.info
warn
cloudbees-info-license
API license must be declared.
$.info
error
cloudbees-server-https
All server URLs must use HTTPS.
$.servers[*].url
warn
cloudbees-feature-mgmt-base
CloudBees Feature Management server URLs must point at x-api.rollout.io.
$.servers[?(@.url && @.url.indexOf('rollout.io') > -1)].url
warn
cloudbees-cd-versioned
CloudBees CD/RO server URLs must include /rest/v1.0.
$.servers[?(@.url && @.url.indexOf('cloudbees') > -1 && @.url.indexOf('cd') > -1)].url
error
cloudbees-bearer-or-basic
A bearer or basic security scheme must be declared.
$.components.securitySchemes
warn
cloudbees-operation-tags
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
cloudbees-operation-summary
Every operation must include a short summary.
$.paths[*][get,post,put,patch,delete]
error
cloudbees-operation-id
Every operation must declare a unique operationId.
$.paths[*][get,post,put,patch,delete]
warn
cloudbees-error-responses
Mutating operations should declare 4xx error responses.
$.paths[*][post,put,patch,delete].responses
info
cloudbees-rate-limit-555
Feature Management endpoints should document the 555 rate-limit response.
$.paths[?(@property.match(/applications|environments|flags|experiments/))][*].responses
info
cloudbees-pagination
List endpoints should support page/limit pagination params.
$.paths[?(@property.match(/applications$|environments$|flags$|experiments$|audit$/))].get.parameters[*].name

Spectral Ruleset

cloudbees-rules.yml Raw ↑
extends:
  - spectral:oas

# Spectral linting rules tuned for the CloudBees API surface.
# Validates conventions across CloudBees CI (Jenkins-derived), CloudBees
# CD/RO, and CloudBees Feature Management (Rollout) — JSON responses,
# token-based auth, and resource-oriented paths.
rules:
  cloudbees-info-contact:
    description: API contact information must be present.
    severity: error
    given: "$.info"
    then:
      field: contact
      function: truthy

  cloudbees-info-license:
    description: API license must be declared.
    severity: warn
    given: "$.info"
    then:
      field: license
      function: truthy

  cloudbees-server-https:
    description: All server URLs must use HTTPS.
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  cloudbees-feature-mgmt-base:
    description: CloudBees Feature Management server URLs must point at x-api.rollout.io.
    severity: warn
    given: "$.servers[?(@.url && @.url.indexOf('rollout.io') > -1)].url"
    then:
      function: pattern
      functionOptions:
        match: "/public-api(/|$)"

  cloudbees-cd-versioned:
    description: CloudBees CD/RO server URLs must include /rest/v1.0.
    severity: warn
    given: "$.servers[?(@.url && @.url.indexOf('cloudbees') > -1 && @.url.indexOf('cd') > -1)].url"
    then:
      function: pattern
      functionOptions:
        match: "/rest/v1\\.0(/|$)"

  cloudbees-bearer-or-basic:
    description: A bearer or basic security scheme must be declared.
    severity: error
    given: "$.components.securitySchemes"
    then:
      function: truthy

  cloudbees-operation-tags:
    description: Every operation must declare at least one tag.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1

  cloudbees-operation-summary:
    description: Every operation must include a short summary.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  cloudbees-operation-id:
    description: Every operation must declare a unique operationId.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  cloudbees-error-responses:
    description: Mutating operations should declare 4xx error responses.
    severity: warn
    given: "$.paths[*][post,put,patch,delete].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ["400"]
            - required: ["401"]
            - required: ["403"]
            - required: ["404"]
            - required: ["422"]

  cloudbees-rate-limit-555:
    description: Feature Management endpoints should document the 555 rate-limit response.
    severity: info
    given: "$.paths[?(@property.match(/applications|environments|flags|experiments/))][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ["555"]
            - required: ["429"]

  cloudbees-pagination:
    description: List endpoints should support page/limit pagination params.
    severity: info
    given: "$.paths[?(@property.match(/applications$|environments$|flags$|experiments$|audit$/))].get.parameters[*].name"
    then:
      function: enumeration
      functionOptions:
        values:
          - page
          - limit
          - offset
          - per_page
          - cursor
          - sort