Runa · API Governance Rules

Runa API Rules

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

18 Rules error 2 warn 15 info 1
View Rules File View on GitHub

Rule Categories

error no operation query runa schema servers

Rules

warn
runa-operation-ids-camel-case
All operationIds must use camelCase naming convention.
$.paths.*[get,post,put,patch,delete].operationId
warn
runa-tags-title-case
All tags must use Title Case.
$.tags[*].name
warn
runa-api-key-header
All operations must use X-Api-Key apiKey authentication.
$.components.securitySchemes.apiKeyAuth
warn
runa-idempotency-key-on-orders
Order creation endpoint should document X-Idempotency-Key header.
$.paths.*.post.parameters[?(@.name=='X-Idempotency-Key')]
warn
runa-paths-kebab-case
All path segments must use kebab-case.
$.paths
error
runa-response-200-defined
All operations must define a 200 response.
$.paths.*[get,post,put,patch,delete].responses
warn
runa-401-defined
All secured endpoints must define a 401 response.
$.paths.*[get,post].responses
warn
runa-summaries-title-case
Operation summaries must use Title Case.
$.paths.*[get,post,put,patch,delete].summary
info
runa-versioned-api
API version should be expressed in the server URL path.
$.servers[*].url
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
servers-expected-domain
Server URLs should be on the runa.io domain.
$.servers[*].url
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')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-security-required
Every operation should declare its security requirements.
$.paths[*][get,post,put,patch,delete]
warn
error-schema-defined
A shared error schema (Error) should be defined for error payloads.
$.components.schemas
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
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# runa — 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: 2/2 servers on runa.io
#   - query-params-casing: snake @ 100% (n=9)
#   - operationid-casing: camel @ 90% (n=10)
#   - schema-names-casing: pascal @ 100% (n=10)
#   - schema-properties-casing: snake @ 100% (n=35)
#   - operation-security-required: 10/10 ops declare per-op security
#   - error-schema-defined: Error
#   - operation-documents-401: 100% adherence
#   - pagination params observed: ['page', 'per_page']
#   - merge: kept 9 existing, added 9 measured, upgraded 0
#   - added: servers-https-only, servers-expected-domain, query-params-casing, schema-names-casing, schema-properties-casing, operation-security-required, error-schema-defined, operation-documents-401, no-empty-descriptions
extends:
  - spectral:oas
rules:
  runa-operation-ids-camel-case:
    description: All operationIds must use camelCase naming convention.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  runa-tags-title-case:
    description: All tags must use Title Case.
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][a-zA-Z0-9 ]*$
  runa-api-key-header:
    description: All operations must use X-Api-Key apiKey authentication.
    severity: warn
    given: $.components.securitySchemes.apiKeyAuth
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            name:
              const: X-Api-Key
  runa-idempotency-key-on-orders:
    description: Order creation endpoint should document X-Idempotency-Key header.
    severity: warn
    given: $.paths.*.post.parameters[?(@.name=='X-Idempotency-Key')]
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            in:
              const: header
  runa-paths-kebab-case:
    description: All path segments must use kebab-case.
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9{}-]+)+$
  runa-response-200-defined:
    description: All operations must define a 200 response.
    severity: error
    given: $.paths.*[get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          required:
          - '200'
  runa-401-defined:
    description: All secured endpoints must define a 401 response.
    severity: warn
    given: $.paths.*[get,post].responses
    then:
      function: schema
      functionOptions:
        schema:
          required:
          - '401'
  runa-summaries-title-case:
    description: Operation summaries must use Title Case.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z]
  runa-versioned-api:
    description: API version should be expressed in the server URL path.
    severity: info
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: /v[0-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 runa.io domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: runa\.io
  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: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  operation-security-required:
    description: Every operation should declare its security requirements.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: security
      function: truthy
  error-schema-defined:
    description: A shared error schema (Error) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: Error
      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
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy