Alliance Data Systems (Bread Financial Holdings) API Rules

Spectral linting rules defining API design standards and conventions for Alliance Data Systems (Bread Financial Holdings).

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

Rule Categories

bread

Rules

warn
bread-pay-title-case-summary
Bread Pay operation summaries must be Title Case and prefixed with 'Bread Pay '.
$.paths[*][get,post,put,delete,patch].summary
error
bread-pay-amount-minor-units
Monetary amount objects must use {value: integer, currency: ISO-4217}.
$.components.schemas.Amount.properties
error
bread-pay-oauth-security
Operations must declare OAuth 2.0 client_credentials as the security scheme.
$.components.securitySchemes
warn
bread-pay-base-url-versioning
Servers must include both production and preview Bread Pay base URLs.
$.servers
warn
bread-pay-transaction-id-uuid
Transaction IDs must be uuid format.
$.paths['/transaction/{transactionID}'].parameters

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
formats:
  - oas3

functions: []

rules:
  bread-pay-title-case-summary:
    description: "Bread Pay operation summaries must be Title Case and prefixed with 'Bread Pay '."
    given: $.paths[*][get,post,put,delete,patch].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^Bread Pay [A-Z][A-Za-z]+( [A-Z][A-Za-z]+){0,8}$"

  bread-pay-amount-minor-units:
    description: "Monetary amount objects must use {value: integer, currency: ISO-4217}."
    given: $.components.schemas.Amount.properties
    severity: error
    then:
      - field: value.type
        function: pattern
        functionOptions:
          match: "^integer$"
      - field: currency.type
        function: pattern
        functionOptions:
          match: "^string$"

  bread-pay-oauth-security:
    description: "Operations must declare OAuth 2.0 client_credentials as the security scheme."
    given: $.components.securitySchemes
    severity: error
    then:
      field: oauth2ClientCredentials.flows.clientCredentials.tokenUrl
      function: truthy

  bread-pay-base-url-versioning:
    description: "Servers must include both production and preview Bread Pay base URLs."
    given: $.servers
    severity: warn
    then:
      function: length
      functionOptions:
        min: 2

  bread-pay-transaction-id-uuid:
    description: "Transaction IDs must be uuid format."
    given: $.paths['/transaction/{transactionID}'].parameters
    severity: warn
    then:
      field: schema.format
      function: pattern
      functionOptions:
        match: "^uuid$"