Saildrone · API Governance Rules

Saildrone API Rules

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

6 Rules error 4 warn 2
View Rules File View on GitHub

Rule Categories

saildrone

Rules

error
saildrone-operation-summary-required
Every operation must have a non-empty Title Case summary.
$.paths[*][get,post,put,patch,delete]
warn
saildrone-operation-id-camel-case
operationId should be camelCase.
$.paths[*][get,post,put,patch,delete].operationId
error
saildrone-paths-must-be-versioned
All Saildrone Mission API resource paths must be versioned under /v1 (the /health probe is the only allowed exception).
$.paths
warn
saildrone-bearer-auth-required
All non-public operations must declare bearer auth (the /health and /v1/auth operations are the only allowed exceptions).
$.paths[?(@property != '/health' && @property != '/v1/auth')][get,post,put,patch,delete]
error
saildrone-dataset-enum
Any parameter named data_set must enumerate the four canonical Saildrone datasets.
$.paths[*][get,post,put,patch,delete].parameters[?(@.name == 'data_set')].schema.enum
error
saildrone-time-params-iso
start_date and end_date query params must be date-time strings.
$.paths[*][get,post,put,patch,delete].parameters[?(@.name == 'start_date' || @.name == 'end_date')].schema

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
rules:
  saildrone-operation-summary-required:
    description: Every operation must have a non-empty Title Case summary.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  saildrone-operation-id-camel-case:
    description: operationId should be camelCase.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]*$'
  saildrone-paths-must-be-versioned:
    description: All Saildrone Mission API resource paths must be versioned under /v1 (the /health probe is the only allowed exception).
    severity: error
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: '^/(health|v1/)'
  saildrone-bearer-auth-required:
    description: All non-public operations must declare bearer auth (the /health and /v1/auth operations are the only allowed exceptions).
    severity: warn
    given: $.paths[?(@property != '/health' && @property != '/v1/auth')][get,post,put,patch,delete]
    then:
      field: security
      function: truthy
  saildrone-dataset-enum:
    description: Any parameter named data_set must enumerate the four canonical Saildrone datasets.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.name == 'data_set')].schema.enum
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            enum: [vehicle, atmospheric, oceanographic, biogeochemical]
  saildrone-time-params-iso:
    description: start_date and end_date query params must be date-time strings.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].parameters[?(@.name == 'start_date' || @.name == 'end_date')].schema"
    then:
      field: format
      function: pattern
      functionOptions:
        match: '^date-time$'