Routific · API Governance Rules

Routific API Rules

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

4 Rules error 1 warn 3
View Rules File View on GitHub

Rule Categories

routific

Rules

warn
routific-snake-case-properties
All schema property names must use snake_case (Routific convention).
$.components.schemas.*.properties.*~
error
routific-security-bearer
Security must use bearer auth (Routific JWT tokens).
$.components.securitySchemes.*
warn
routific-server-url
Production server URL must be https://api.routific.com.
$.servers[0].url
warn
routific-async-202
Endpoints whose path ends in '-long' must return a 202 response.
$.paths[?(@property =~ /-long$/)].post.responses

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
rules:
  # Routific convention: every operation must have a description.
  operation-description: error
  # Operation summaries must use Title Case (project-wide convention).
  operation-summary: error
  # Routific uses snake_case for all field names in request/response bodies.
  routific-snake-case-properties:
    description: All schema property names must use snake_case (Routific convention).
    severity: warn
    given: "$.components.schemas.*.properties.*~"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-z0-9_]*$"
  # Routific tokens are JWTs sent as bearer auth.
  routific-security-bearer:
    description: Security must use bearer auth (Routific JWT tokens).
    severity: error
    given: "$.components.securitySchemes.*"
    then:
      field: scheme
      function: pattern
      functionOptions:
        match: "^bearer$"
  # Production base URL must be api.routific.com.
  routific-server-url:
    description: Production server URL must be https://api.routific.com.
    severity: warn
    given: "$.servers[0].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://api\\.routific\\.com"
  # Every long-running endpoint should return 202 with a job_id.
  routific-async-202:
    description: Endpoints whose path ends in '-long' must return a 202 response.
    severity: warn
    given: "$.paths[?(@property =~ /-long$/)].post.responses"
    then:
      field: "202"
      function: truthy