SearchStax · API Governance Rules

SearchStax API Rules

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

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

Rule Categories

searchstax

Rules

warn
searchstax-operation-ids-camel-case
Operation IDs must use camelCase
$.paths[*][*].operationId
error
searchstax-tags-required
All operations must have at least one tag
$.paths[*][*]
warn
searchstax-summaries-title-case
Operation summaries must use Title Case
$.paths[*][*].summary
warn
searchstax-account-path-parameter
Deployment management paths must include account_name path parameter
$.paths['/api/rest/v2/account/{account_name}/*']
warn
searchstax-delete-responses
DELETE operations should return 204 No Content
$.paths[*][delete].responses
info
searchstax-post-response-201
POST create operations should return 201 Created
$.paths[*][post].responses
error
searchstax-token-auth
Operations should document authentication requirements
$.paths[*][*]
info
searchstax-path-parameters-kebab
Path parameters should use snake_case
$.paths[*][*].parameters[?(@.in=='path')].name

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  searchstax-operation-ids-camel-case:
    description: Operation IDs must use camelCase
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  searchstax-tags-required:
    description: All operations must have at least one tag
    severity: error
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  searchstax-summaries-title-case:
    description: Operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*(\\s[A-Z][a-zA-Z0-9]*)*$"

  searchstax-account-path-parameter:
    description: Deployment management paths must include account_name path parameter
    severity: warn
    given: "$.paths['/api/rest/v2/account/{account_name}/*']"
    then:
      function: truthy

  searchstax-delete-responses:
    description: DELETE operations should return 204 No Content
    severity: warn
    given: "$.paths[*][delete].responses"
    then:
      field: "204"
      function: truthy

  searchstax-post-response-201:
    description: POST create operations should return 201 Created
    severity: info
    given: "$.paths[*][post].responses"
    then:
      field: "201"
      function: truthy

  searchstax-token-auth:
    description: Operations should document authentication requirements
    severity: error
    given: "$.paths[*][*]"
    then:
      field: security
      function: truthy

  searchstax-path-parameters-kebab:
    description: Path parameters should use snake_case
    severity: info
    given: "$.paths[*][*].parameters[?(@.in=='path')].name"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-z0-9_]*$"