Ironclad · API Governance Rules

Ironclad API Rules

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

8 Rules error 1 warn 6 info 1
View Rules File View on GitHub

Rule Categories

ironclad

Rules

warn
ironclad-info-version-numeric
Ironclad uses a single integer (1) as the API version on every public spec.
$.info.version
warn
ironclad-server-includes-region
Every Ironclad server URL must encode a region (na1, eu1, or demo).
$.servers[*].url
warn
ironclad-operation-id-camelcase
Ironclad operationIds are camelCase.
$.paths[*][get,post,put,patch,delete].operationId
warn
ironclad-operation-summary-title-case
Operation summaries should be Title Case (e.g., "List All Workflows", not "list all workflows").
$.paths[*][get,post,put,patch,delete].summary
error
ironclad-tag-defined
Every operation must be tagged with at least one of the canonical resource tags.
$.paths[*][get,post,put,patch,delete]
info
ironclad-pagination-cursor-param
List endpoints should expose cursor-based pagination via a 'nextPageToken' or 'cursor' query parameter.
$.paths[?(@.get && @.get.operationId =~ /list.*/i)].get.parameters[*].name
warn
ironclad-error-schema-defined
4xx and 5xx responses should reference a shared error schema.
$.paths[*][get,post,put,patch,delete].responses['400','401','403','404','409','422','429','500']
warn
ironclad-oauth-bearer-security
Public API operations should declare the OAuth bearer security scheme.
$.paths[*][get,post,put,patch,delete]

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
  - spectral:asyncapi
functions: []
rules:
  ironclad-info-version-numeric:
    description: Ironclad uses a single integer (1) as the API version on every public spec.
    severity: warn
    given: $.info.version
    then:
      function: pattern
      functionOptions:
        match: '^[0-9]+$'

  ironclad-server-includes-region:
    description: Every Ironclad server URL must encode a region (na1, eu1, or demo).
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: '^https://(na1|eu1|demo)\\.ironcladapp\\.com'

  ironclad-operation-id-camelcase:
    description: Ironclad operationIds are camelCase.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][A-Za-z0-9]+$'

  ironclad-operation-summary-title-case:
    description: Operation summaries should be Title Case (e.g., "List All Workflows", not "list all workflows").
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][A-Za-z0-9-]*(\\s|$))+'

  ironclad-tag-defined:
    description: Every operation must be tagged with at least one of the canonical resource tags.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - Workflows
              - Records
              - Entities
              - Obligations
              - Webhooks
              - Exports
              - Search
              - OAuth
              - SCIM
              - Users
              - Groups
              - Schemas

  ironclad-pagination-cursor-param:
    description: List endpoints should expose cursor-based pagination via a 'nextPageToken' or 'cursor' query parameter.
    severity: info
    given: $.paths[?(@.get && @.get.operationId =~ /list.*/i)].get.parameters[*].name
    then:
      function: enumeration
      functionOptions:
        values:
          - cursor
          - nextPageToken
          - pageToken
          - page

  ironclad-error-schema-defined:
    description: 4xx and 5xx responses should reference a shared error schema.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses['400','401','403','404','409','422','429','500']
    then:
      field: content.application/json.schema.$ref
      function: defined

  ironclad-oauth-bearer-security:
    description: Public API operations should declare the OAuth bearer security scheme.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: security
      function: defined