SingularityNET · API Governance Rules

SingularityNET API Rules

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

7 Rules error 1 warn 5 info 1
View Rules File View on GitHub

Rule Categories

singularitynet

Rules

warn
singularitynet-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
warn
singularitynet-operation-ids-camel-case
Operation IDs should use camelCase.
$.paths[*][*].operationId
warn
singularitynet-tags-required
All operations must include at least one tag.
$.paths[*][*]
warn
singularitynet-description-required
All operations must have a description.
$.paths[*][*]
error
singularitynet-response-200-required
Successful operations must define a 200 response.
$.paths[*][*].responses
info
singularitynet-data-envelope
Response bodies should use a data envelope wrapper.
$.paths[*][*].responses['200'].content['application/json'].schema.properties
warn
singularitynet-path-params-described
All path parameters must have descriptions.
$.paths[*][*].parameters[?(@.in == "path")]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  singularitynet-operation-summary-title-case:
    description: All operation summaries must use Title Case.
    message: 'Summary "{{value}}" must use Title Case.'
    severity: warn
    given: '$.paths[*][*].summary'
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][a-z]+(\s[A-Z][a-z]+)*$'

  singularitynet-operation-ids-camel-case:
    description: Operation IDs should use camelCase.
    message: 'OperationId "{{value}}" should be camelCase.'
    severity: warn
    given: '$.paths[*][*].operationId'
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'

  singularitynet-tags-required:
    description: All operations must include at least one tag.
    message: Operation must include at least one tag.
    severity: warn
    given: '$.paths[*][*]'
    then:
      field: tags
      function: defined

  singularitynet-description-required:
    description: All operations must have a description.
    message: Operation must include a description.
    severity: warn
    given: '$.paths[*][*]'
    then:
      field: description
      function: defined

  singularitynet-response-200-required:
    description: Successful operations must define a 200 response.
    message: Operation must define a 200 success response.
    severity: error
    given: '$.paths[*][*].responses'
    then:
      field: '200'
      function: defined

  singularitynet-data-envelope:
    description: Response bodies should use a data envelope wrapper.
    message: Response body should wrap content in a data property.
    severity: info
    given: "$.paths[*][*].responses['200'].content['application/json'].schema.properties"
    then:
      field: data
      function: defined

  singularitynet-path-params-described:
    description: All path parameters must have descriptions.
    message: Path parameter must have a description.
    severity: warn
    given: '$.paths[*][*].parameters[?(@.in == "path")]'
    then:
      field: description
      function: defined