Abstract API · API Governance Rules

Abstract API API Rules

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

40 Rules error 17 warn 17 info 6
View Rules File View on GitHub

Rule Categories

delete error generated get info no openapi operation operationid parameter paths query response schema security servers tags

Rules

error
info-title-required
Info title must be present and start with "Abstract API"
$.info
error
info-description-required
Info description must be present
$.info
error
info-version-required
Info version must be present
$.info
error
openapi-version-3
Must use OpenAPI 3.0.x
$
error
servers-required
At least one server must be defined
$
error
servers-https-only
All server URLs must use HTTPS
$.servers[*]
warn
servers-abstractapi-domain
Server URLs should be under abstractapi.com domain
$.servers[*]
warn
paths-kebab-case
Path segments must use kebab-case (lowercase with hyphens)
$.paths
warn
paths-no-trailing-slash
Paths must not have trailing slashes (except root /)
$.paths
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-title-case
Operation summary must start with "Abstract API"
$.paths[*][get,post,put,patch,delete]
error
operation-description-required
Every operation must have a description
$.paths[*][get,post,put,patch,delete]
error
operation-id-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
operation-id-camel-case
operationId must use camelCase
$.paths[*][get,post,put,patch,delete]
error
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete]
info
operation-microcks-extension
Operations should have x-microcks-operation extension for mock server compatibility
$.paths[*][get,post,put,patch,delete]
warn
tags-title-case
Tags should use Title Case
$.tags[*]
error
parameter-description-required
Every parameter must have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
warn
parameter-api-key-query
Abstract API uses api_key as the query parameter name for authentication
$.paths[*][get,post,put,patch,delete].parameters[?(@.name == "api_key")]
error
parameter-schema-required
Every parameter must have a schema with type
$.paths[*][get,post,put,patch,delete].parameters[*]
info
parameter-example-recommended
Parameters should have example values
$.paths[*][get,post,put,patch,delete].parameters[*]
error
response-success-required
Every operation must have a 2xx success response
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-required
Operations secured with API key should document 401 response
$.paths[*][get,post,put,patch,delete].responses
info
response-429-recommended
Rate-limited APIs should document 429 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
Schema properties should have descriptions
$.components.schemas[*].properties[*]
info
schema-property-example
Schema properties should have example values
$.components.schemas[*].properties[*]
warn
schema-top-level-description
Top-level schemas should have descriptions
$.components.schemas[*]
error
security-schemes-defined
Security schemes must be defined in components
$
warn
security-api-key-scheme
Abstract API uses apiKey security scheme
$.components.securitySchemes[*]
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
warn
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
generated-from-docs-marked
Generated specs should be marked with x-generated-from
$.info
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
operationid-casing
Operation IDs should be camelCase (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].operationId
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
error-schema-defined
A shared error schema (ErrorResponse) should be defined for error payloads.
$.components.schemas
warn
operation-documents-400
Operations should document a 400 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
# abstract-api — 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: 14/14 servers on abstractapi.com
#   - query-params-casing: snake @ 100% (n=73)
#   - operationid-casing: camel @ 100% (n=19)
#   - schema-names-casing: pascal @ 100% (n=49)
#   - schema-properties-casing: snake @ 100% (n=239)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: ErrorResponse
#   - operation-documents-400: 100% adherence
#   - operation-documents-401: 100% adherence
#   - pagination params observed: ['size']
#   - merge: kept 34 existing, added 6 measured, upgraded 0
#   - added: query-params-casing, operationid-casing, schema-names-casing, schema-properties-casing, error-schema-defined, operation-documents-400
extends:
  - spectral:oas
rules:
  info-title-required:
    description: Info title must be present and start with "Abstract API"
    severity: error
    given: $.info
    then:
      field: title
      function: pattern
      functionOptions:
        match: ^Abstract API
  info-description-required:
    description: Info description must be present
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: Info version must be present
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  openapi-version-3:
    description: Must use OpenAPI 3.0.x
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.0\.
  servers-required:
    description: At least one server must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    description: All server URLs must use HTTPS
    severity: error
    given: $.servers[*]
    then:
      field: url
      function: pattern
      functionOptions:
        match: ^https://
  servers-abstractapi-domain:
    description: Server URLs should be under abstractapi.com domain
    severity: warn
    given: $.servers[*]
    then:
      field: url
      function: pattern
      functionOptions:
        match: abstractapi\.com
  paths-kebab-case:
    description: Path segments must use kebab-case (lowercase with hyphens)
    severity: warn
    given: $.paths
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^(\/[a-z0-9_\-\{\}]*)*$
  paths-no-trailing-slash:
    description: Paths must not have trailing slashes (except root /)
    severity: warn
    given: $.paths
    then:
      field: '@key'
      function: pattern
      functionOptions:
        notMatch: .+\/$
  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-title-case:
    description: Operation summary must start with "Abstract API"
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: pattern
      functionOptions:
        match: ^Abstract API
  operation-description-required:
    description: Every operation must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  operation-id-required:
    description: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  operation-id-camel-case:
    description: operationId must use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]+$
  operation-tags-required:
    description: Every operation must have at least one tag
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  operation-microcks-extension:
    description: Operations should have x-microcks-operation extension for mock server compatibility
    severity: info
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: x-microcks-operation
      function: truthy
  tags-title-case:
    description: Tags should use Title Case
    severity: warn
    given: $.tags[*]
    then:
      field: name
      function: pattern
      functionOptions:
        match: ^[A-Z]
  parameter-description-required:
    description: Every parameter must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy
  parameter-api-key-query:
    description: Abstract API uses api_key as the query parameter name for authentication
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.name == "api_key")]
    then:
      field: in
      function: enumeration
      functionOptions:
        values:
        - query
        - header
  parameter-schema-required:
    description: Every parameter must have a schema with type
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: schema
      function: truthy
  parameter-example-recommended:
    description: Parameters should have example values
    severity: info
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: example
      function: truthy
  response-success-required:
    description: Every operation must have a 2xx success 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-required:
    description: Operations secured with API key should document 401 response
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  response-429-recommended:
    description: Rate-limited APIs should document 429 response
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '429'
      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
  schema-property-description:
    description: Schema properties should have descriptions
    severity: info
    given: $.components.schemas[*].properties[*]
    then:
      field: description
      function: truthy
  schema-property-example:
    description: Schema properties should have example values
    severity: info
    given: $.components.schemas[*].properties[*]
    then:
      field: example
      function: truthy
  schema-top-level-description:
    description: Top-level schemas should have descriptions
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  security-schemes-defined:
    description: Security schemes must be defined in components
    severity: error
    given: $
    then:
      field: components.securitySchemes
      function: truthy
  security-api-key-scheme:
    description: Abstract API uses apiKey security scheme
    severity: warn
    given: $.components.securitySchemes[*]
    then:
      field: type
      function: enumeration
      functionOptions:
        values:
        - apiKey
        - http
  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  delete-no-request-body:
    description: DELETE operations should not have a request body
    severity: warn
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy
  no-empty-descriptions:
    description: Descriptions must not be empty strings
    severity: error
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: .+
  generated-from-docs-marked:
    description: Generated specs should be marked with x-generated-from
    severity: info
    given: $.info
    then:
      field: x-generated-from
      function: truthy
  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
  operationid-casing:
    description: Operation IDs should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][A-Za-z0-9]*$
  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: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  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
  error-schema-defined:
    description: A shared error schema (ErrorResponse) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: ErrorResponse
      function: truthy
  operation-documents-400:
    description: Operations should document a 400 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '400'
      function: truthy