Truist Financial · API Governance Rules

Truist Financial API Rules

Spectral linting rules defining API design standards and conventions for Truist Financial.

12 Rules error 2 warn 8 info 2
View Rules File View on GitHub

Rule Categories

truist

Rules

warn
truist-operation-ids-camel-case
Truist operation IDs must use camelCase format.
$.paths.*[get,post,put,patch,delete]
warn
truist-path-segments-kebab-case
Truist URL path segments must use kebab-case (lowercase with hyphens).
$.paths
info
truist-versioned-paths
Truist paths should NOT include version in the path (versioning is handled at server level).
$.paths
error
truist-personal-or-commercial-prefix
Truist paths must start with /personal or /commercial to indicate product line.
$.paths
error
truist-oauth2-security
All Truist API operations must require OAuth2 security.
$.paths.*[get,post,put,patch,delete]
warn
truist-response-200-json
Truist 200 responses must include application/json content type.
$.paths.*[get,post,put,patch,delete].responses.200
warn
truist-operations-have-tags
All Truist operations must have at least one tag for categorization.
$.paths.*[get,post,put,patch,delete]
warn
truist-amount-fields-double
Amount/balance fields in Truist schemas must use number type with double format.
$.components.schemas.*.properties[*Balance,*Amount,amount,balance]
warn
truist-account-id-string
Account and transaction identifiers must be string type.
$.components.schemas.*.properties[accountId,transactionId,customerId]
warn
truist-date-format
Date fields in Truist schemas must use date or date-time format.
$.components.schemas.*.properties[*Date,*DateTime]
info
truist-currency-default-usd
Currency fields in Truist schemas should default to USD.
$.components.schemas.*.properties.currency
warn
truist-pagination-params
Collection endpoints must support limit and offset pagination parameters.
$.paths.*[get]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  truist-operation-ids-camel-case:
    description: Truist operation IDs must use camelCase format.
    severity: warn
    given: "$.paths.*[get,post,put,patch,delete]"
    then:
      field: operationId
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  truist-path-segments-kebab-case:
    description: Truist URL path segments must use kebab-case (lowercase with hyphens).
    severity: warn
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}-]+)*$"

  truist-versioned-paths:
    description: Truist paths should NOT include version in the path (versioning is handled at server level).
    severity: info
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        notMatch: "^/v[0-9]"

  truist-personal-or-commercial-prefix:
    description: Truist paths must start with /personal or /commercial to indicate product line.
    severity: error
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^/(personal|commercial)"

  truist-oauth2-security:
    description: All Truist API operations must require OAuth2 security.
    severity: error
    given: "$.paths.*[get,post,put,patch,delete]"
    then:
      field: security
      function: truthy

  truist-response-200-json:
    description: Truist 200 responses must include application/json content type.
    severity: warn
    given: "$.paths.*[get,post,put,patch,delete].responses.200"
    then:
      field: content.application/json
      function: truthy

  truist-operations-have-tags:
    description: All Truist operations must have at least one tag for categorization.
    severity: warn
    given: "$.paths.*[get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  truist-amount-fields-double:
    description: Amount/balance fields in Truist schemas must use number type with double format.
    severity: warn
    given: "$.components.schemas.*.properties[*Balance,*Amount,amount,balance]"
    then:
      field: format
      function: enumeration
      functionOptions:
        values:
          - double
          - float

  truist-account-id-string:
    description: Account and transaction identifiers must be string type.
    severity: warn
    given: "$.components.schemas.*.properties[accountId,transactionId,customerId]"
    then:
      field: type
      function: enumeration
      functionOptions:
        values:
          - string

  truist-date-format:
    description: Date fields in Truist schemas must use date or date-time format.
    severity: warn
    given: "$.components.schemas.*.properties[*Date,*DateTime]"
    then:
      field: format
      function: enumeration
      functionOptions:
        values:
          - date
          - date-time

  truist-currency-default-usd:
    description: Currency fields in Truist schemas should default to USD.
    severity: info
    given: "$.components.schemas.*.properties.currency"
    then:
      field: default
      function: enumeration
      functionOptions:
        values:
          - USD

  truist-pagination-params:
    description: Collection endpoints must support limit and offset pagination parameters.
    severity: warn
    given: "$.paths.*[get]"
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            parameters:
              type: array
              contains:
                properties:
                  name:
                    enum: [limit, offset]