Clear Channel Outdoor Holdings · API Governance Rules

Clear Channel Outdoor Holdings API Rules

Spectral linting rules defining API design standards and conventions for Clear Channel Outdoor Holdings.

7 Rules error 5 warn 2
View Rules File View on GitHub

Rule Categories

cco

Rules

error
cco-info-title-required
API title must be set and identify Clear Channel Outdoor.
$.info.title
error
cco-server-url-direct
Servers must include the canonical direct.cco.io gateway.
$.servers[*].url
error
cco-oauth2-client-credentials-required
APIs must declare an OAuth2 clientCredentials security scheme with the canonical token URL.
$.components.securitySchemes[*]
error
cco-paths-versioned
Path entries MUST be prefixed with a version segment (e.g. /v1, /v2, /v3).
$.paths[*]~
warn
cco-operation-summary-title-case
Operation summaries should use Title Case.
$.paths[*][get,post,put,patch,delete].summary
error
cco-operation-tagged
Every operation must be tagged with one of the canonical CCO resource tags.
$.paths[*][get,post,put,patch,delete].tags
warn
cco-search-pagination-params
Collection-search GET endpoints should expose offset and limit parameters.
$.paths[*].get

Spectral Ruleset

Raw ↑
extends: [["@stoplight/spectral-rulesets/oas", off]]
documentationUrl: https://github.com/api-evangelist/clear-channel-outdoor-hldgs/tree/main/rules
rules:
  cco-info-title-required:
    description: API title must be set and identify Clear Channel Outdoor.
    severity: error
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: "(?i)clear channel"

  cco-server-url-direct:
    description: Servers must include the canonical direct.cco.io gateway.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://(direct|developer|api)\\.cco\\.io"

  cco-oauth2-client-credentials-required:
    description: APIs must declare an OAuth2 clientCredentials security scheme with the canonical token URL.
    severity: error
    given: $.components.securitySchemes[*]
    then:
      - field: type
        function: enumeration
        functionOptions: { values: [oauth2] }
      - field: flows.clientCredentials.tokenUrl
        function: pattern
        functionOptions:
          match: "^https://direct\\.cco\\.io/v2/token$"

  cco-paths-versioned:
    description: Path entries MUST be prefixed with a version segment (e.g. /v1, /v2, /v3).
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: "^/v[0-9]+/"

  cco-operation-summary-title-case:
    description: Operation summaries should use Title Case.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][A-Za-z0-9]*)( [A-Z0-9][A-Za-z0-9]*)*$"

  cco-operation-tagged:
    description: Every operation must be tagged with one of the canonical CCO resource tags.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].tags
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - Displays
              - Networks
              - Markets
              - Products
              - Orders
              - Bookings
              - Campaigns
              - Creatives
              - Photos
              - Customers
              - Accounts
              - Contracts
              - Pricing
              - Renewals
              - Restrictions
              - Taxonomies
              - Authentication

  cco-search-pagination-params:
    description: Collection-search GET endpoints should expose offset and limit parameters.
    severity: warn
    given: $.paths[*].get
    then:
      field: parameters
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            type: object
            properties:
              name: { enum: [offset, limit, filter] }
            required: [name]