ActiveCampaign · API Governance Rules

ActiveCampaign API Rules

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

26 Rules error 12 warn 12 info 2
View Rules File View on GitHub

Rule Categories

examples http info no openapi operation parameter paths request response schema security servers

Rules

warn
info-title-format
API title should start with "ActiveCampaign"
$.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-kebab-case
Path segments should use camelCase or kebab-case (no underscores in path segments)
$.paths[*]~
error
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 "ActiveCampaign"
$.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-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[*]
error
parameter-schema-required
Every parameter must have a schema
$.paths[*][get,post,put,patch,delete].parameters[*]
warn
request-body-json-content
Request bodies should have application/json content type
$.paths[*][post,put,patch].requestBody.content
error
response-success-required
Every operation must have at least one 2xx response
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-defined
Operations with security should document 401 response
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
Every response must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
info
schema-property-description
Top-level schema objects should have descriptions
$.components.schemas[*]
error
security-schemes-defined
Security schemes must be defined in components
$.components
warn
security-api-token-header
API Token should be sent in the Api-Token header
$.components.securitySchemes[*]
error
http-get-no-request-body
GET operations should not have a request body
$.paths[*].get
warn
http-delete-no-request-body
DELETE operations should not have a request body
$.paths[*].delete
error
no-empty-descriptions
Descriptions must not be empty strings
$..description
info
examples-encouraged
Schema properties should have example values
$.components.schemas[*].properties[*]

Spectral Ruleset

Raw ↑
rules:

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

  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 - NAMING CONVENTIONS
  paths-kebab-case:
    description: Path segments should use camelCase or kebab-case (no underscores in path segments)
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: "/_[a-z]/"

  paths-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: error
    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 "ActiveCampaign"
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: "^ActiveCampaign "

  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-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

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

  # REQUEST BODIES
  request-body-json-content:
    description: Request bodies should have application/json content type
    severity: warn
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      field: application/json
      function: truthy

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

  response-401-defined:
    description: Operations with security should document 401 response
    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

  # SCHEMAS
  schema-property-description:
    description: Top-level schema objects should have descriptions
    severity: info
    given: $.components.schemas[*]
    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-api-token-header:
    description: API Token should be sent in the Api-Token header
    severity: warn
    given: $.components.securitySchemes[*]
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            in:
              enum: ['header']

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

  http-delete-no-request-body:
    description: DELETE operations should not have a request body
    severity: warn
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy

  # GENERAL QUALITY
  no-empty-descriptions:
    description: Descriptions must not be empty strings
    severity: error
    given: $..description
    then:
      function: truthy

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