VesselFinder · API Governance Rules

VesselFinder API Rules

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

9 Rules error 6 warn 3
View Rules File View on GitHub

Rule Categories

vesselfinder

Rules

error
vesselfinder-info-contact
VesselFinder OpenAPI documents must declare a contact.
$.info
error
vesselfinder-info-license
VesselFinder OpenAPI documents must declare a license.
$.info
error
vesselfinder-https-only
Servers must use HTTPS.
$.servers[*].url
warn
vesselfinder-operation-summary-title-case
Operation summaries must use Title Case.
$.paths[*][*].summary
error
vesselfinder-operation-description
Every operation must have a description.
$.paths[*][*]
error
vesselfinder-operation-id-camel-case
operationId must be lowerCamelCase.
$.paths[*][*].operationId
warn
vesselfinder-tags-defined
Each operation must reference at least one tag defined in the root tags array.
$.paths[*][*].tags
warn
vesselfinder-userkey-required
Every operation must require the userkey API key parameter (AIS API only).
$.paths[?(@path != '/container/{apiKey}/{containerNumber}/{sealine}')][*].parameters[?(@.name == 'userkey')]
error
vesselfinder-no-trailing-slash
Paths must not end with a trailing slash.
$.paths

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
rules:
  vesselfinder-info-contact:
    description: VesselFinder OpenAPI documents must declare a contact.
    severity: error
    given: $.info
    then:
      field: contact
      function: truthy
  vesselfinder-info-license:
    description: VesselFinder OpenAPI documents must declare a license.
    severity: error
    given: $.info
    then:
      field: license
      function: truthy
  vesselfinder-https-only:
    description: Servers must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: '^https://'
  vesselfinder-operation-summary-title-case:
    description: Operation summaries 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]*)*$'
  vesselfinder-operation-description:
    description: Every operation must have a description.
    severity: error
    given: $.paths[*][*]
    then:
      field: description
      function: truthy
  vesselfinder-operation-id-camel-case:
    description: operationId must be lowerCamelCase.
    severity: error
    given: $.paths[*][*].operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'
  vesselfinder-tags-defined:
    description: Each operation must reference at least one tag defined in the root tags array.
    severity: warn
    given: $.paths[*][*].tags
    then:
      function: truthy
  vesselfinder-userkey-required:
    description: Every operation must require the userkey API key parameter (AIS API only).
    severity: warn
    given: "$.paths[?(@path != '/container/{apiKey}/{containerNumber}/{sealine}')][*].parameters[?(@.name == 'userkey')]"
    then:
      field: required
      function: truthy
  vesselfinder-no-trailing-slash:
    description: Paths must not end with a trailing slash.
    severity: error
    given: $.paths
    then:
      function: pattern
      functionOptions:
        notMatch: '/$'