TD SYNNEX · API Governance Rules

TD SYNNEX API Rules

Spectral linting rules defining API design standards and conventions for TD SYNNEX.

12 Rules error 2 warn 9 info 1
View Rules File View on GitHub

Rule Categories

tdsynnex

Rules

warn
tdsynnex-path-versioning
All API paths should be versioned with /v3/ prefix
$.paths[*]~
warn
tdsynnex-path-account-id
Partner resource paths should include {accountId} parameter
$.paths[/v3/*]~
error
tdsynnex-operation-ids-required
All operations must have operationId defined
$.paths[*][get,post,put,delete,patch]
warn
tdsynnex-operation-ids-camelcase
operationId values should use camelCase
$.paths[*][get,post,put,delete,patch].operationId
warn
tdsynnex-tags-defined
All operations should be tagged
$.paths[*][get,post,put,delete,patch]
warn
tdsynnex-security-defined
Operations (except token endpoint) should require OAuth2
$.paths[/v3/*][get,post,put,delete,patch]
error
tdsynnex-responses-success
GET operations should define a 200 success response
$.paths[*].get.responses
warn
tdsynnex-post-responses-201
POST create operations should return 201 Created
$.paths[/v3/accounts/{accountId}/customers,/v3/accounts/{accountId}/orders,/v3/accounts/{accountId}/customers/{customerId}/carts].post.responses
warn
tdsynnex-error-401
Authenticated operations should define 401 Unauthorized
$.paths[/v3/*][get,post,put,delete,patch].responses
warn
tdsynnex-summary-title-case
Operation summaries should use Title Case
$.paths[*][get,post,put,delete,patch].summary
warn
tdsynnex-request-body-content-type
POST and PUT operations should specify application/json content type
$.paths[*][post,put].requestBody.content
info
tdsynnex-pagination-parameters
List operations should support pagination parameters
$.paths[*].get

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  tdsynnex-path-versioning:
    description: All API paths should be versioned with /v3/ prefix
    message: "Path '{{property}}' should be versioned with /v3/ prefix (or /oauth/ for auth)"
    severity: warn
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^(/v3/|/oauth/)"

  tdsynnex-path-account-id:
    description: Partner resource paths should include {accountId} parameter
    message: "Partner resource path '{{property}}' should include {accountId}"
    severity: warn
    given: "$.paths[/v3/*]~"
    then:
      function: pattern
      functionOptions:
        match: ".*\\{accountId\\}.*"

  tdsynnex-operation-ids-required:
    description: All operations must have operationId defined
    message: "Operation is missing operationId"
    severity: error
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: operationId
      function: defined

  tdsynnex-operation-ids-camelcase:
    description: operationId values should use camelCase
    message: "operationId '{{value}}' should use camelCase"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  tdsynnex-tags-defined:
    description: All operations should be tagged
    message: "Operation is missing tags"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: tags
      function: defined

  tdsynnex-security-defined:
    description: Operations (except token endpoint) should require OAuth2
    message: "Operation should define security requirements"
    severity: warn
    given: "$.paths[/v3/*][get,post,put,delete,patch]"
    then:
      function: defined

  tdsynnex-responses-success:
    description: GET operations should define a 200 success response
    message: "GET operation is missing 200 response"
    severity: error
    given: "$.paths[*].get.responses"
    then:
      field: "200"
      function: defined

  tdsynnex-post-responses-201:
    description: POST create operations should return 201 Created
    message: "POST create operation should return 201"
    severity: warn
    given: "$.paths[/v3/accounts/{accountId}/customers,/v3/accounts/{accountId}/orders,/v3/accounts/{accountId}/customers/{customerId}/carts].post.responses"
    then:
      field: "201"
      function: defined

  tdsynnex-error-401:
    description: Authenticated operations should define 401 Unauthorized
    message: "Operation is missing 401 Unauthorized response"
    severity: warn
    given: "$.paths[/v3/*][get,post,put,delete,patch].responses"
    then:
      field: "401"
      function: defined

  tdsynnex-summary-title-case:
    description: Operation summaries should use Title Case
    message: "Summary '{{value}}' should use Title Case"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"

  tdsynnex-request-body-content-type:
    description: POST and PUT operations should specify application/json content type
    message: "POST/PUT operation should specify application/json request body content type"
    severity: warn
    given: "$.paths[*][post,put].requestBody.content"
    then:
      field: "application/json"
      function: defined

  tdsynnex-pagination-parameters:
    description: List operations should support pagination parameters
    message: "List operation should support page and pageSize parameters"
    severity: info
    given: "$.paths[*].get"
    then:
      function: defined