Symantec · API Governance Rules

Symantec API Rules

Spectral linting rules defining API design standards and conventions for Symantec.

7 Rules warn 6
View Rules File View on GitHub

Rule Categories

symantec

Rules

warn
symantec-bearer-auth
SEPM API must define Bearer authentication scheme
$.components.securitySchemes
warn
symantec-operation-id-camel-case
Operation IDs must use camelCase naming convention
$.paths[*][get,post,put,patch,delete]
warn
symantec-summary-title-case
Operation summaries must use Title Case
$.paths[*][get,post,put,patch,delete].summary
warn
symantec-security-required
Non-authentication endpoints must require Bearer token
$.paths[?(@property != '/identity/authenticate')][get,post,put,patch,delete]
warn
symantec-auth-response
All operations must document 401 Unauthorized response
$.paths[*][get,post,put,patch,delete].responses
hint
symantec-pagination-parameters
List endpoints should support pageSize and pageIndex query parameters
$.paths[?(@property.endsWith('s') || @property.endsWith('computers'))].get
warn
symantec-operation-tags
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]

rules:
  # SEPM uses Bearer token authentication
  symantec-bearer-auth:
    description: SEPM API must define Bearer authentication scheme
    severity: warn
    given: "$.components.securitySchemes"
    then:
      field: BearerAuth
      function: truthy

  # Operation IDs must use camelCase
  symantec-operation-id-camel-case:
    description: Operation IDs must use camelCase naming convention
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  # Summaries must use Title Case
  symantec-summary-title-case:
    description: Operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9 ]+$"

  # All operations (except auth) must have security defined
  symantec-security-required:
    description: Non-authentication endpoints must require Bearer token
    severity: warn
    given: "$.paths[?(@property != '/identity/authenticate')][get,post,put,patch,delete]"
    then:
      field: security
      function: truthy

  # 401 response must be defined
  symantec-auth-response:
    description: All operations must document 401 Unauthorized response
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].responses"
    then:
      field: '401'
      function: truthy

  # GET list endpoints should support pagination
  symantec-pagination-parameters:
    description: List endpoints should support pageSize and pageIndex query parameters
    severity: hint
    given: "$.paths[?(@property.endsWith('s') || @property.endsWith('computers'))].get"
    then:
      field: parameters
      function: truthy

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