RubyGems · API Governance Rules

RubyGems API Rules

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

8 Rules error 1 warn 6 info 1
View Rules File View on GitHub

Rule Categories

rubygems

Rules

warn
rubygems-operation-ids-camel-case
All operationIds must use camelCase naming convention.
$.paths.*[get,post,put,patch,delete].operationId
warn
rubygems-tags-title-case
All tags must use Title Case.
$.tags[*].name
warn
rubygems-api-key-auth
Authenticated endpoints must use apiKeyAuth or basicAuth security schemes.
$.components.securitySchemes
warn
rubygems-json-responses
All GET endpoints should return application/json content type.
$.paths.*.get.responses.200.content
info
rubygems-paths-snake-case-params
Query parameter names should use snake_case per RubyGems convention.
$.paths.*[get,post,delete].parameters[?(@.in=='query')].name
error
rubygems-response-200-defined
All operations must define a 200 or 201 response.
$.paths.*[get,post,put,patch,delete].responses
warn
rubygems-401-on-protected
Protected endpoints must define a 401 response.
$.paths.*[post,delete,patch].responses
warn
rubygems-summaries-title-case
Operation summaries must use Title Case.
$.paths.*[get,post,put,patch,delete].summary

Spectral Ruleset

Raw ↑
rules:
  rubygems-operation-ids-camel-case:
    description: All operationIds must use camelCase naming convention.
    severity: warn
    given: "$.paths.*[get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  rubygems-tags-title-case:
    description: All tags must use Title Case.
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]*$"

  rubygems-api-key-auth:
    description: Authenticated endpoints must use apiKeyAuth or basicAuth security schemes.
    severity: warn
    given: "$.components.securitySchemes"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          oneOf:
            - required: ["apiKeyAuth"]
            - required: ["basicAuth"]

  rubygems-json-responses:
    description: All GET endpoints should return application/json content type.
    severity: warn
    given: "$.paths.*.get.responses.200.content"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            application/json:
              type: object

  rubygems-paths-snake-case-params:
    description: Query parameter names should use snake_case per RubyGems convention.
    severity: info
    given: "$.paths.*[get,post,delete].parameters[?(@.in=='query')].name"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-z0-9_]*$"

  rubygems-response-200-defined:
    description: All operations must define a 200 or 201 response.
    severity: error
    given: "$.paths.*[get,post,put,patch,delete].responses"
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ["200"]
            - required: ["201"]

  rubygems-401-on-protected:
    description: Protected endpoints must define a 401 response.
    severity: warn
    given: "$.paths.*[post,delete,patch].responses"
    then:
      function: schema
      functionOptions:
        schema:
          required:
            - "401"

  rubygems-summaries-title-case:
    description: Operation summaries must use Title Case.
    severity: warn
    given: "$.paths.*[get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"