Ruby Programming Language and Popular API Gems API Rules

Spectral linting rules defining API design standards and conventions for Ruby Programming Language and Popular API Gems.

7 Rules error 5 warn 2
View Rules File View on GitHub

Rule Categories

rubygems

Rules

error
rubygems-operation-summary-required
Every operation must have a Title Case summary.
$.paths[*][get,post,put,delete,patch,head,options]
warn
rubygems-operation-summary-title-case
Operation summaries must use Title Case (per API Evangelist convention).
$.paths[*][get,post,put,delete,patch,head,options].summary
error
rubygems-operation-id-required
Every operation must declare an operationId for SDK generation.
$.paths[*][get,post,put,delete,patch,head,options]
error
rubygems-tags-required
Every operation must have at least one tag for grouping.
$.paths[*][get,post,put,delete,patch,head,options]
warn
rubygems-json-only-success
2xx responses must offer application/json.
$.paths[*][get,post,put,delete,patch].responses['200','201'].content
error
rubygems-versioned-path
All RubyGems paths must be prefixed with /api/v1/ or /api/v2/.
$.paths
error
rubygems-api-key-security
Mutating operations (POST, PUT, DELETE) must require ApiKeyAuth.
$.paths[*][post,put,delete]

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
documentationUrl: https://guides.rubygems.org/rubygems-org-api/
rules:
  rubygems-operation-summary-required:
    description: Every operation must have a Title Case summary.
    given: $.paths[*][get,post,put,delete,patch,head,options]
    severity: error
    then:
      field: summary
      function: truthy

  rubygems-operation-summary-title-case:
    description: Operation summaries must use Title Case (per API Evangelist convention).
    given: $.paths[*][get,post,put,delete,patch,head,options].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9]*( [A-Z][A-Za-z0-9]*)*$"

  rubygems-operation-id-required:
    description: Every operation must declare an operationId for SDK generation.
    given: $.paths[*][get,post,put,delete,patch,head,options]
    severity: error
    then:
      field: operationId
      function: truthy

  rubygems-tags-required:
    description: Every operation must have at least one tag for grouping.
    given: $.paths[*][get,post,put,delete,patch,head,options]
    severity: error
    then:
      field: tags
      function: length
      functionOptions:
        min: 1

  rubygems-json-only-success:
    description: 2xx responses must offer application/json.
    given: $.paths[*][get,post,put,delete,patch].responses['200','201'].content
    severity: warn
    then:
      field: application/json
      function: truthy

  rubygems-versioned-path:
    description: All RubyGems paths must be prefixed with /api/v1/ or /api/v2/.
    given: $.paths
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "^/api/v[12]/"
      field: "@key"

  rubygems-api-key-security:
    description: Mutating operations (POST, PUT, DELETE) must require ApiKeyAuth.
    given: $.paths[*][post,put,delete]
    severity: error
    then:
      field: security
      function: truthy