Actor Model · API Governance Rules

Actor Model API Rules

Spectral linting rules defining API design standards and conventions for Actor Model.

24 Rules error 9 warn 12 info 3
View Rules File View on GitHub

Rule Categories

actor http info openapi operation pagination parameter paths response schema security servers

Rules

warn
info-title-format
API title should start with "Actor Model"
$.info.title
error
info-description-required
Info object must have a description
$.info
error
info-version-required
Info object must include a version
$.info
warn
openapi-version
Should use OpenAPI 3.x
$.openapi
error
servers-defined
At least one server must be defined
$
warn
servers-https
All servers should use HTTPS
$.servers[*].url
warn
paths-no-trailing-slash
Paths must not have trailing slashes
$.paths[*]~
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-prefix
Operation summary should start with "Actor Model"
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation should have a description
$.paths[*][get,post,put,patch,delete]
error
operation-operationId-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
operation-operationId-camelCase
OperationId should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
parameter-description-required
Every parameter must have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
info
pagination-cursor-limit
List endpoints should support cursor and limit parameters for seek-based pagination
$.paths[*][get]
error
response-success-required
Every operation must have a 2xx response
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-defined
Operations should document 401 Unauthorized
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
Every response must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
error
security-schemes-defined
Security schemes must be defined in components
$.components
warn
security-bearer
Actor system management APIs should use bearer token authentication
$.components.securitySchemes[*].scheme
error
http-get-no-request-body
GET operations should not have a request body
$.paths[*].get
warn
schema-description-required
Component schemas should have descriptions
$.components.schemas[*]
info
schema-property-examples
Schema properties should have example values
$.components.schemas[*].properties[*]
info
actor-path-format
Actor paths should follow hierarchical format starting with /
$.paths[/actors/**]~

Spectral Ruleset

Raw ↑
rules:

  # INFO / METADATA
  info-title-format:
    description: API title should start with "Actor Model"
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: "^Actor Model"

  info-description-required:
    description: Info object must have a description
    severity: error
    given: $.info
    then:
      field: description
      function: truthy

  info-version-required:
    description: Info object must include a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy

  # OPENAPI VERSION
  openapi-version:
    description: Should use OpenAPI 3.x
    severity: warn
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: "^3\\."

  # SERVERS
  servers-defined:
    description: At least one server must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy

  servers-https:
    description: All servers should use HTTPS
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  # PATHS
  paths-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: "[^/]/$"

  # OPERATIONS
  operation-summary-required:
    description: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy

  operation-summary-prefix:
    description: Operation summary should start with "Actor Model"
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: "^Actor Model "

  operation-description-required:
    description: Every operation should have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy

  operation-operationId-required:
    description: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy

  operation-operationId-camelCase:
    description: OperationId should use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: casing
      functionOptions:
        type: camel

  operation-tags-required:
    description: Every operation must have at least one tag
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy

  # PARAMETERS
  parameter-description-required:
    description: Every parameter must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy

  # PAGINATION
  pagination-cursor-limit:
    description: List endpoints should support cursor and limit parameters for seek-based pagination
    severity: info
    given: $.paths[*][get]
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            parameters:
              type: array

  # RESPONSES
  response-success-required:
    description: Every operation must have a 2xx response
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ['200']
            - required: ['201']
            - required: ['202']
            - required: ['204']

  response-401-defined:
    description: Operations should document 401 Unauthorized
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy

  response-description-required:
    description: Every response must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy

  # SECURITY
  security-schemes-defined:
    description: Security schemes must be defined in components
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy

  security-bearer:
    description: Actor system management APIs should use bearer token authentication
    severity: warn
    given: $.components.securitySchemes[*].scheme
    then:
      function: enumeration
      functionOptions:
        values: ['bearer']

  # HTTP METHODS
  http-get-no-request-body:
    description: GET operations should not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy

  # SCHEMAS
  schema-description-required:
    description: Component schemas should have descriptions
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy

  schema-property-examples:
    description: Schema properties should have example values
    severity: info
    given: $.components.schemas[*].properties[*]
    then:
      field: example
      function: truthy

  # ACTOR-SPECIFIC
  actor-path-format:
    description: Actor paths should follow hierarchical format starting with /
    severity: info
    given: $.paths[/actors/**]~
    then:
      function: pattern
      functionOptions:
        match: "^/actors"