Absentify · API Governance Rules

Absentify API Rules

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

28 Rules error 5 warn 19 info 4
View Rules File View on GitHub

Rule Categories

absentify error no operation path query schema security servers

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
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
servers-expected-domain
Server URLs should be on the absentify.com domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
info
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
warn
error-schema-defined
A shared error schema (error.BAD_REQUEST) should be defined for error payloads.
$.components.schemas
warn
operation-documents-400
Operations should document a 400 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-401
Operations should document a 401 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-403
Operations should document a 403 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-500
Operations should document a 500 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# absentify — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on absentify.com
#   - path-params-casing: snake @ 100% (n=29)
#   - query-params-casing: snake @ 100% (n=29)
#   - schema-names-casing: pascal @ 58% (n=12)
#   - schema-properties-casing: snake @ 80% (n=61)
#   - operation-security-required: 40/40 ops declare per-op security
#   - error-schema-defined: error.BAD_REQUEST
#   - operation-documents-400: 100% adherence
#   - operation-documents-401: 100% adherence
#   - operation-documents-403: 100% adherence
#   - operation-documents-500: 100% adherence
#   - merge: kept 15 existing, added 13 measured, upgraded 0
#   - added: servers-https-only, servers-expected-domain, path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, security-schemes-defined, error-schema-defined, operation-documents-400, operation-documents-401, operation-documents-403, operation-documents-500, no-empty-descriptions
extends:
  - spectral:oas
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_/-{}]*$
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-expected-domain:
    description: Server URLs should be on the absentify.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: absentify\.com
  path-params-casing:
    description: Path parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: snake
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  security-schemes-defined:
    description: Security schemes should be defined in components.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  error-schema-defined:
    description: A shared error schema (error.BAD_REQUEST) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: error.BAD_REQUEST
      function: truthy
  operation-documents-400:
    description: Operations should document a 400 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '400'
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  operation-documents-403:
    description: Operations should document a 403 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '403'
      function: truthy
  operation-documents-500:
    description: Operations should document a 500 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '500'
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy