Absentify · API Governance Rules

Absentify API Rules

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

15 Rules error 4 warn 9 info 2
View Rules File View on GitHub

Rule Categories

absentify

Rules

error
absentify-operation-must-have-summary
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
warn
absentify-operation-must-have-description
Every operation must have a description
$.paths[*][get,post,put,patch,delete]
error
absentify-operation-must-have-operation-id
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
absentify-operation-must-have-tags
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
absentify-summary-title-case
Operation summaries should be in Title Case
$.paths[*][get,post,put,patch,delete].summary
warn
absentify-parameters-must-have-description
All parameters must have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
error
absentify-request-body-must-have-schema
Request body content must define a schema
$.paths[*][post,put,patch].requestBody.content[*]
warn
absentify-response-must-have-schema
Successful responses should define a schema
$.paths[*][get,post,put,patch,delete].responses[200,201]
warn
absentify-security-must-use-api-key
Operations should use ApiKeyAuth security
$.paths[*][get,post,put,patch,delete]
warn
absentify-schema-properties-must-have-type
Schema properties must define a type
$.components.schemas[*].properties[*]
warn
absentify-info-must-have-contact
API info must have contact information
$.info
info
absentify-info-must-have-license
API info must have license information
$.info
error
absentify-server-must-be-defined
At least one server must be defined
$
warn
absentify-components-schemas-must-exist
Components section should define reusable schemas
$.components
info
absentify-paths-must-use-kebab-case
Path segments should use kebab-case
$.paths

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, recommended]]
rules:
  absentify-operation-must-have-summary:
    description: Every operation must have a summary
    message: "Operation {{path}} is missing a summary"
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  absentify-operation-must-have-description:
    description: Every operation must have a description
    message: "Operation {{path}} is missing a description"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: description
      function: truthy

  absentify-operation-must-have-operation-id:
    description: Every operation must have an operationId
    message: "Operation {{path}} is missing an operationId"
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  absentify-operation-must-have-tags:
    description: Every operation must have at least one tag
    message: "Operation {{path}} must have at least one tag"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  absentify-summary-title-case:
    description: Operation summaries should be in Title Case
    message: "Summary '{{value}}' should start with 'Absentify'"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^Absentify"

  absentify-parameters-must-have-description:
    description: All parameters must have a description
    message: "Parameter {{path}} is missing a description"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].parameters[*]"
    then:
      field: description
      function: truthy

  absentify-request-body-must-have-schema:
    description: Request body content must define a schema
    message: "Request body at {{path}} must define a schema"
    severity: error
    given: "$.paths[*][post,put,patch].requestBody.content[*]"
    then:
      field: schema
      function: truthy

  absentify-response-must-have-schema:
    description: Successful responses should define a schema
    message: "Response at {{path}} should define a schema"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].responses[200,201]"
    then:
      field: content
      function: truthy

  absentify-security-must-use-api-key:
    description: Operations should use ApiKeyAuth security
    message: "Operation {{path}} should specify security requirements"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: security
      function: truthy

  absentify-schema-properties-must-have-type:
    description: Schema properties must define a type
    message: "Schema property {{path}} must have a type"
    severity: warn
    given: "$.components.schemas[*].properties[*]"
    then:
      field: type
      function: truthy

  absentify-info-must-have-contact:
    description: API info must have contact information
    message: "API info is missing contact information"
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy

  absentify-info-must-have-license:
    description: API info must have license information
    message: "API info is missing license information"
    severity: info
    given: "$.info"
    then:
      field: license
      function: truthy

  absentify-server-must-be-defined:
    description: At least one server must be defined
    message: "API must define at least one server"
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  absentify-components-schemas-must-exist:
    description: Components section should define reusable schemas
    message: "API should define component schemas for reusability"
    severity: warn
    given: "$.components"
    then:
      field: schemas
      function: truthy

  absentify-paths-must-use-kebab-case:
    description: Path segments should use kebab-case
    message: "Path {{path}} should use kebab-case or underscores for readability"
    severity: info
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^/[a-z0-9_/-{}]*$"