Red Hat Enterprise Linux · API Governance Rules

Red Hat Enterprise Linux API Rules

Spectral linting rules defining API design standards and conventions for Red Hat Enterprise Linux.

9 Rules error 4 warn 5
View Rules File View on GitHub

Rule Categories

rhel

Rules

warn
rhel-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][get,post,put,patch,delete].summary
warn
rhel-operation-id-kebab-case
Operation IDs should be camelCase
$.paths[*][get,post,put,patch,delete].operationId
warn
rhel-tags-must-be-title-case
Tags must use Title Case
$.paths[*][get,post,put,patch,delete].tags[*]
error
rhel-must-have-security
All operations must define security requirements
$.paths[*][get,post,put,patch,delete]
error
rhel-responses-must-include-200
GET operations must return a 200 response
$.paths[*].get
warn
rhel-json-response-content-type
API responses must use application/json content type
$.paths[*][get].responses[200].content
warn
rhel-parameters-must-have-description
All parameters must have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
error
rhel-path-params-must-be-required
Path parameters must be marked as required
$.paths[*][get,post,put,patch,delete].parameters[?(@.in == 'path')]
error
rhel-server-must-be-https
All servers must use HTTPS
$.servers[*].url

Spectral Ruleset

Raw ↑
rules:
  rhel-operation-summary-title-case:
    description: All operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-z]* )*[A-Z][a-z]*$"

  rhel-operation-id-kebab-case:
    description: Operation IDs should be camelCase
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  rhel-tags-must-be-title-case:
    description: Tags must use Title Case
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].tags[*]"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]*$"

  rhel-must-have-security:
    description: All operations must define security requirements
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: security
      function: defined

  rhel-responses-must-include-200:
    description: GET operations must return a 200 response
    severity: error
    given: "$.paths[*].get"
    then:
      field: responses.200
      function: defined

  rhel-json-response-content-type:
    description: API responses must use application/json content type
    severity: warn
    given: "$.paths[*][get].responses[200].content"
    then:
      field: application/json
      function: defined

  rhel-parameters-must-have-description:
    description: All parameters must have a description
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].parameters[*]"
    then:
      field: description
      function: defined

  rhel-path-params-must-be-required:
    description: Path parameters must be marked as required
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].parameters[?(@.in == 'path')]"
    then:
      field: required
      function: truthy

  rhel-server-must-be-https:
    description: All servers must use HTTPS
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"