Snow Software · API Governance Rules

Snow Software API Rules

Spectral linting rules defining API design standards and conventions for Snow Software.

9 Rules warn 4 info 5
View Rules File View on GitHub

Rule Categories

snow

Rules

warn
snow-operation-id-camel-case
Operation IDs must use camelCase naming convention
$.paths[*][*].operationId
warn
snow-server-region-variable
Snow Atlas server URLs should include a {region} variable for multi-region support
$.servers[*].url
info
snow-pagination-params
Collection endpoints should support page_number and page_size parameters
$.paths[*].get.parameters[*].name
info
snow-filter-param
Snow Atlas APIs should support filter query parameters for collection endpoints
$.paths[*].get
warn
snow-operation-tag
All operations must have at least one tag
$.paths[*][get,post,put,delete,patch]
warn
snow-operation-summary
All operations must have a summary in Title Case
$.paths[*][get,post,put,delete,patch]
info
snow-operation-description
All operations should have a description
$.paths[*][get,post,put,delete,patch]
info
snow-hateoas-response
Snow Atlas collection responses follow a HATEOAS pattern with pagination links
$.paths[*][get].responses['200'].content['application/json'].schema
info
snow-400-error-defined
Operations should define a 400 Bad Request response
$.paths[*][post,put,patch].responses

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  # Operation naming
  snow-operation-id-camel-case:
    description: Operation IDs must use camelCase naming convention
    message: "operationId '{{value}}' must be camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  # Region variable in server
  snow-server-region-variable:
    description: Snow Atlas server URLs should include a {region} variable for multi-region support
    message: "Server URL should include {region} variable for Snow Atlas multi-region"
    severity: warn
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: ".*\\{region\\}.*"

  # Pagination parameters
  snow-pagination-params:
    description: Collection endpoints should support page_number and page_size parameters
    message: "Collection GET operations should support pagination parameters"
    severity: info
    given: "$.paths[*].get.parameters[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^(page_number|page_size|filter|sort)$"

  # Filter parameter
  snow-filter-param:
    description: Snow Atlas APIs should support filter query parameters for collection endpoints
    message: "Collection GET endpoints should support a filter parameter"
    severity: info
    given: "$.paths[*].get"
    then:
      field: parameters
      function: truthy

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

  # Summary requirements
  snow-operation-summary:
    description: All operations must have a summary in Title Case
    message: "Operation must have a summary"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: summary
      function: truthy

  # Description requirements
  snow-operation-description:
    description: All operations should have a description
    message: "Operation should have a description"
    severity: info
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: description
      function: truthy

  # HATEOAS response pattern
  snow-hateoas-response:
    description: Snow Atlas collection responses follow a HATEOAS pattern with pagination links
    message: "200 response should have a defined schema"
    severity: info
    given: "$.paths[*][get].responses['200'].content['application/json'].schema"
    then:
      function: truthy

  # Error response definitions
  snow-400-error-defined:
    description: Operations should define a 400 Bad Request response
    message: "Operation should define a 400 response"
    severity: info
    given: "$.paths[*][post,put,patch].responses"
    then:
      field: "400"
      function: truthy