Bloomberg L.P. · API Governance Rules

Bloomberg L.P. API Rules

Spectral linting rules defining API design standards and conventions for Bloomberg L.P..

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

Rule Categories

openfigi

Rules

warn
openfigi-operation-summary-title-case
Operation summaries must use Title Case across the OpenFIGI API.
$.paths.*.*.summary
error
openfigi-operation-id-camel-case
Operation IDs should be lowerCamelCase verbs (e.g. mapIdentifiers).
$.paths.*.*.operationId
warn
openfigi-path-versioned
All paths should be hosted under the /v3 server, not include /v3 in the path itself.
$.paths
warn
openfigi-tag-title-case
Tags must be Title Case.
$.tags[*].name
error
openfigi-server-https
Servers must use HTTPS only.
$.servers[*].url
error
openfigi-apikey-header-name
The OpenFIGI API key header is X-OPENFIGI-APIKEY.
$.components.securitySchemes[?(@.type == 'apiKey')]
warn
openfigi-error-responses-required
Every operation must document at least 400, 429, and 5xx responses.
$.paths.*.*.responses
info
openfigi-figi-pattern
FIGI string properties should declare the BBG[A-Z0-9]{9} pattern.
$.components.schemas.FigiRecord.properties.figi

Spectral Ruleset

Raw ↑
extends: ["spectral:oas"]
rules:
  openfigi-operation-summary-title-case:
    description: Operation summaries must use Title Case across the OpenFIGI API.
    severity: warn
    given: "$.paths.*.*.summary"
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-zA-Z0-9'/-]*)( ([A-Z][a-zA-Z0-9'/-]*|For|To|And|Or|The|A|An|With|In|Of|On|By))*$"
  openfigi-operation-id-camel-case:
    description: Operation IDs should be lowerCamelCase verbs (e.g. mapIdentifiers).
    severity: error
    given: "$.paths.*.*.operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"
  openfigi-path-versioned:
    description: All paths should be hosted under the /v3 server, not include /v3 in the path itself.
    severity: warn
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        notMatch: "^/v[0-9]+/"
  openfigi-tag-title-case:
    description: Tags must 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]*)*$"
  openfigi-server-https:
    description: Servers must use HTTPS only.
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"
  openfigi-apikey-header-name:
    description: The OpenFIGI API key header is X-OPENFIGI-APIKEY.
    severity: error
    given: "$.components.securitySchemes[?(@.type == 'apiKey')]"
    then:
      field: name
      function: pattern
      functionOptions:
        match: "^X-OPENFIGI-APIKEY$"
  openfigi-error-responses-required:
    description: Every operation must document at least 400, 429, and 5xx responses.
    severity: warn
    given: "$.paths.*.*.responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required: ["400", "429"]
  openfigi-figi-pattern:
    description: FIGI string properties should declare the BBG[A-Z0-9]{9} pattern.
    severity: info
    given: "$.components.schemas.FigiRecord.properties.figi"
    then:
      field: pattern
      function: truthy