SaaS Alerts · API Governance Rules

SaaS Alerts API Rules

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

17 Rules error 3 warn 13 info 1
View Rules File View on GitHub

Rule Categories

no operation query saas schema security servers

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[*]~
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
servers-expected-domain
Server URLs should be on the saasalerts.com domain.
$.servers[*].url
warn
query-params-casing
Query parameters should be camelCase (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be camelCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
warn
operation-documents-401
Operations should document a 401 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# saas-alerts — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on saasalerts.com
#   - query-params-casing: camel @ 67% (n=21)
#   - operationid-casing: camel @ 100% (n=5)
#   - schema-names-casing: pascal @ 100% (n=10)
#   - schema-properties-casing: camel @ 61% (n=57)
#   - operation-security-required: 5/5 ops declare per-op security
#   - operation-documents-401: 100% adherence
#   - pagination params observed: ['page', 'pageSize']
#   - merge: kept 9 existing, added 8 measured, upgraded 0
#   - added: servers-https-only, servers-expected-domain, query-params-casing, schema-names-casing, schema-properties-casing, security-schemes-defined, operation-documents-401, no-empty-descriptions
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]*$
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-expected-domain:
    description: Server URLs should be on the saasalerts.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: saasalerts\.com
  query-params-casing:
    description: Query parameters should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: camel
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be camelCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: camel
  security-schemes-defined:
    description: Security schemes should be defined in components.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy