Retool · API Governance Rules

Retool API Rules

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

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

Rule Categories

retool

Rules

warn
retool-operation-id-camel-case
Operation IDs should use camelCase following the Retool API convention.
$.paths[*][*].operationId
warn
retool-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
error
retool-tags-defined
All operations must have at least one tag for grouping in the API reference.
$.paths[*][*]
warn
retool-response-200-schema
Successful GET responses must include a response schema.
$.paths[*].get.responses.200
error
retool-request-body-post-put
POST and PUT operations must include a request body.
$.paths[*][post,put]
warn
retool-error-responses
Operations should document 401 and 403 error responses.
$.paths[*][get,post,put,delete].responses
hint
retool-uuid-path-params
User ID path parameters should be named 'userId' and use UUID format.
$.paths[*][*].parameters[?(@.in == 'path' && @.name == 'id')]
error
retool-bearer-auth-scheme
The Retool API uses Bearer token authentication exclusively.
$.components.securitySchemes[*]
hint
retool-pagination-parameters
List endpoints returning collections should support page and pageSize parameters.
$.paths[*].get

Spectral Ruleset

Raw ↑
extends: ["spectral:oas"]

rules:
  retool-operation-id-camel-case:
    description: Operation IDs should use camelCase following the Retool API convention.
    message: "Operation ID '{{value}}' should use camelCase (e.g., listUsers, createUser, deleteApp)."
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  retool-operation-summary-title-case:
    description: All operation summaries must use Title Case.
    message: "Summary '{{value}}' should use Title Case (capitalize each significant word)."
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]*$"

  retool-tags-defined:
    description: All operations must have at least one tag for grouping in the API reference.
    message: "Operation is missing tags. Add at least one tag from the defined tags list."
    severity: error
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  retool-response-200-schema:
    description: Successful GET responses must include a response schema.
    message: "GET operation '{{path}}' should define a response schema for 200 OK."
    severity: warn
    given: "$.paths[*].get.responses.200"
    then:
      field: content
      function: truthy

  retool-request-body-post-put:
    description: POST and PUT operations must include a request body.
    message: "POST/PUT operation must define a requestBody."
    severity: error
    given: "$.paths[*][post,put]"
    then:
      field: requestBody
      function: truthy

  retool-error-responses:
    description: Operations should document 401 and 403 error responses.
    message: "Operation should define 401 Unauthorized response."
    severity: warn
    given: "$.paths[*][get,post,put,delete].responses"
    then:
      field: "401"
      function: truthy

  retool-uuid-path-params:
    description: User ID path parameters should be named 'userId' and use UUID format.
    message: "User ID parameter should be named 'userId' with uuid format."
    severity: hint
    given: "$.paths[*][*].parameters[?(@.in == 'path' && @.name == 'id')]"
    then:
      function: falsy

  retool-bearer-auth-scheme:
    description: The Retool API uses Bearer token authentication exclusively.
    message: "Security scheme should use Bearer token (http, bearer)."
    severity: error
    given: "$.components.securitySchemes[*]"
    then:
      function: schema
      functionOptions:
        schema:
          oneOf:
            - properties:
                type:
                  const: http
                scheme:
                  const: bearer

  retool-pagination-parameters:
    description: List endpoints returning collections should support page and pageSize parameters.
    message: "List endpoint (GET returning array) should define pagination parameters."
    severity: hint
    given: "$.paths[*].get"
    then:
      function: truthy