Spaceflight News API · API Governance Rules

Spaceflight News API API Rules

Spectral linting rules defining API design standards and conventions for Spaceflight News API.

9 Rules error 1 warn 5 info 3
View Rules File View on GitHub

Rule Categories

snapi

Rules

warn
snapi-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
warn
snapi-operation-id-camel-case
All operationIds must use camelCase
$.paths[*][*].operationId
warn
snapi-tags-title-case
All tags must use Title Case
$.tags[*].name
info
snapi-paths-trailing-slash
SpaceAPI Django-based paths use trailing slashes
$.paths[*]~
warn
snapi-list-endpoints-have-pagination
List endpoints should have limit and offset parameters
$.paths[*].get
warn
snapi-response-must-have-description
All responses must have a description
$.paths[*][*].responses[*]
info
snapi-schema-properties-have-descriptions
Schema properties should have descriptions
$.components.schemas[*].properties[*]
error
snapi-servers-must-be-https
All server URLs must use HTTPS
$.servers[*].url
info
snapi-api-versioned-path
API base path should include version prefix
$.servers[*].url

Spectral Ruleset

Raw ↑
rules:
  snapi-operation-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-z0-9]*)(\\s[A-Z][a-z0-9]*)*$"

  snapi-operation-id-camel-case:
    description: All operationIds must use camelCase
    message: OperationId "{{value}}" must use camelCase
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

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

  snapi-paths-trailing-slash:
    description: SpaceAPI Django-based paths use trailing slashes
    message: Path "{{value}}" should end with a trailing slash
    severity: info
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: ".*/$"

  snapi-list-endpoints-have-pagination:
    description: List endpoints should have limit and offset parameters
    message: List endpoint must include limit and offset query parameters
    severity: warn
    given: "$.paths[*].get"
    then:
      field: parameters
      function: truthy

  snapi-response-must-have-description:
    description: All responses must have a description
    message: Response must have a description
    severity: warn
    given: "$.paths[*][*].responses[*]"
    then:
      field: description
      function: truthy

  snapi-schema-properties-have-descriptions:
    description: Schema properties should have descriptions
    message: Schema property "{{path}}" should have a description
    severity: info
    given: "$.components.schemas[*].properties[*]"
    then:
      field: description
      function: truthy

  snapi-servers-must-be-https:
    description: All server URLs must use HTTPS
    message: Server URL "{{value}}" must use HTTPS
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  snapi-api-versioned-path:
    description: API base path should include version prefix
    message: Server URL should include API version (e.g., /v4)
    severity: info
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "/v[0-9]+"