arcade-dev · API Governance Rules

arcade-dev API Rules

Spectral linting rules defining API design standards and conventions for arcade-dev.

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

Rule Categories

arcade

Rules

error
arcade-base-server
The base server URL must be https://api.arcade.dev.
$.servers[*].url
error
arcade-v1-prefix
All Arcade Engine paths are versioned under /v1/.
$.paths.*~
warn
arcade-summary-title-case
Operation summaries should use Title Case.
$.paths.*.*.summary
warn
arcade-snake-case-properties
JSON property names in Arcade schemas use snake_case.
$.components.schemas.*.properties.*~
warn
arcade-operation-id-camel-case
operationId should be lowerCamelCase.
$.paths.*.*.operationId
error
arcade-response-2xx-required
Every operation must define at least one 2xx response.
$.paths.*.*.responses
warn
arcade-error-envelope
Error responses (4xx/5xx) should reference the Arcade Error schema.
$.paths.*.*.responses[?(@property.match(/^[45]\d\d$/))].content.application/json.schema

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
documentationUrl: https://docs.arcade.dev/references/api
description: Spectral ruleset enforcing Arcade.dev API conventions across the Arcade Engine OpenAPI surface.
rules:
  arcade-base-server:
    description: The base server URL must be https://api.arcade.dev.
    message: 'Servers[].url must equal https://api.arcade.dev'
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: '^https:\/\/api\.arcade\.dev$'
  arcade-v1-prefix:
    description: All Arcade Engine paths are versioned under /v1/.
    message: 'Path must start with /v1/'
    severity: error
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        match: '^\/v1\/'
  arcade-summary-title-case:
    description: Operation summaries should use Title Case.
    message: 'Operation summary should use Title Case'
    severity: warn
    given: $.paths.*.*.summary
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z0-9][A-Za-z0-9 \-/:]+$'
  arcade-snake-case-properties:
    description: JSON property names in Arcade schemas use snake_case.
    message: 'Property "{{property}}" should be snake_case'
    severity: warn
    given: $.components.schemas.*.properties.*~
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-z0-9_]*$'
  arcade-operation-id-camel-case:
    description: operationId should be lowerCamelCase.
    message: 'operationId should be lowerCamelCase'
    severity: warn
    given: $.paths.*.*.operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][A-Za-z0-9]*$'
  arcade-response-2xx-required:
    description: Every operation must define at least one 2xx response.
    severity: error
    given: $.paths.*.*.responses
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: '^2\d\d$'
  arcade-error-envelope:
    description: Error responses (4xx/5xx) should reference the Arcade Error schema.
    severity: warn
    given: '$.paths.*.*.responses[?(@property.match(/^[45]\d\d$/))].content.application/json.schema'
    then:
      function: truthy