SaaS Alerts · API Governance Rules

SaaS Alerts API Rules

Spectral linting rules defining API design standards and conventions for SaaS Alerts.

9 Rules error 2 warn 7
View Rules File View on GitHub

Rule Categories

saas

Rules

warn
saas-alerts-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
warn
saas-alerts-tags-title-case
All tags must use Title Case
$.paths[*][*].tags[*]
warn
saas-alerts-operation-ids-camel-case
Operation IDs must use camelCase
$.paths[*][*].operationId
error
saas-alerts-security-scheme-required
All operations must define security requirements
$.paths[*][get,post,put,patch,delete]
warn
saas-alerts-pagination-params
List operations should support pagination with pageSize and page parameters
$.paths[*][get]
warn
saas-alerts-parameters-have-descriptions
All parameters must have descriptions
$.paths[*][*].parameters[*]
error
saas-alerts-enum-alert-status-values
alertStatus parameters must use defined enum values
$.paths[*][*].parameters[?(@.name == 'alertStatus')].schema
warn
saas-alerts-paths-kebab-case
Path segments must use kebab-case
$.paths[*]~
warn
saas-alerts-schema-names-pascal-case
Component schema names must use PascalCase
$.components.schemas[*]~

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  saas-alerts-summary-title-case:
    description: All operation summaries must use Title Case
    message: "Operation summary '{{value}}' 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]*)*$"

  saas-alerts-tags-title-case:
    description: All tags must use Title Case
    message: "Tag '{{value}}' must use Title Case"
    severity: warn
    given: "$.paths[*][*].tags[*]"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*(\\s[A-Z][a-zA-Z0-9]*)*$"

  saas-alerts-operation-ids-camel-case:
    description: Operation IDs must use camelCase
    message: "Operation ID '{{value}}' must use camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  saas-alerts-security-scheme-required:
    description: All operations must define security requirements
    message: "Operation must define security requirements (API key authentication required)"
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: security
      function: truthy

  saas-alerts-pagination-params:
    description: List operations should support pagination with pageSize and page parameters
    message: "GET list operations should include pageSize and page query parameters"
    severity: warn
    given: "$.paths[*][get]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object

  saas-alerts-parameters-have-descriptions:
    description: All parameters must have descriptions
    message: "Parameter must have a description"
    severity: warn
    given: "$.paths[*][*].parameters[*]"
    then:
      field: description
      function: truthy

  saas-alerts-enum-alert-status-values:
    description: alertStatus parameters must use defined enum values
    message: "alertStatus must be one of: low, medium, critical"
    severity: error
    given: "$.paths[*][*].parameters[?(@.name == 'alertStatus')].schema"
    then:
      field: enum
      function: truthy

  saas-alerts-paths-kebab-case:
    description: Path segments must use kebab-case
    message: "Path segments must use kebab-case"
    severity: warn
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        notMatch: "[A-Z_]"

  saas-alerts-schema-names-pascal-case:
    description: Component schema names must use PascalCase
    message: "Schema name must use PascalCase"
    severity: warn
    given: "$.components.schemas[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*$"