Cradlepoint · API Governance Rules

Cradlepoint API Rules

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

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

Rule Categories

cradlepoint

Rules

warn
cradlepoint-info-contact
NCM specs must surface a Cradlepoint / Ericsson support contact.
$.info
error
cradlepoint-server-must-be-ncm
NCM v2 specs must target the production base URL.
$.servers[*]
warn
cradlepoint-resource-paths-trailing-slash
NCM v2 collection paths use a trailing slash (e.g. /routers/).
$.paths.*~
warn
cradlepoint-resource-paths-snake-case
NCM v2 resource path segments are snake_case.
$.paths.*~
warn
cradlepoint-operation-tags-titlecase
Operation tags should use Title Case singular nouns.
$.paths.*.*.tags[*]
error
cradlepoint-paired-key-auth
NCM v2 requires paired Cradlepoint and NetCloud API-key headers.
$.components.securitySchemes
warn
cradlepoint-operation-summary-titlecase
Operation summaries use Title Case.
$.paths.*.*.summary
warn
cradlepoint-pagination-limit-offset
List endpoints expose `limit` and `offset` query parameters.
$.paths[*].get.parameters

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]
documentationUrl: https://customer.cradlepoint.com/s/article/NCM-APIv2-Overview
rules:
  cradlepoint-info-contact:
    description: NCM specs must surface a Cradlepoint / Ericsson support contact.
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy

  cradlepoint-server-must-be-ncm:
    description: NCM v2 specs must target the production base URL.
    severity: error
    given: $.servers[*]
    then:
      field: url
      function: pattern
      functionOptions:
        match: '^https://www\.cradlepointecm\.com/api/v2$'

  cradlepoint-resource-paths-trailing-slash:
    description: NCM v2 collection paths use a trailing slash (e.g. /routers/).
    severity: warn
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        match: '/$'

  cradlepoint-resource-paths-snake-case:
    description: NCM v2 resource path segments are snake_case.
    severity: warn
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        match: '^/[a-z0-9_/{}]+$'

  cradlepoint-operation-tags-titlecase:
    description: Operation tags should use Title Case singular nouns.
    severity: warn
    given: $.paths.*.*.tags[*]
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][A-Za-z]+$'

  cradlepoint-paired-key-auth:
    description: NCM v2 requires paired Cradlepoint and NetCloud API-key headers.
    severity: error
    given: $.components.securitySchemes
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required: [CradlepointApiKey, NetCloudApiKey]

  cradlepoint-operation-summary-titlecase:
    description: Operation summaries use Title Case.
    severity: warn
    given: $.paths.*.*.summary
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][a-zA-Z0-9]*)( [A-Z][a-zA-Z0-9]*)*$'

  cradlepoint-pagination-limit-offset:
    description: List endpoints expose `limit` and `offset` query parameters.
    severity: warn
    given: $.paths[*].get.parameters
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            type: object
            properties:
              name:
                type: string
                enum: [limit, offset]