CloudEvents · API Governance Rules

CloudEvents API Rules

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

9 Rules error 3 warn 6
View Rules File View on GitHub

Rule Categories

cloudevents

Rules

error
cloudevents-info-contact
API contact information must be present.
$.info
warn
cloudevents-info-license
API license must be declared (CloudEvents publishes under Apache-2.0).
$.info
warn
cloudevents-info-license-apache
CloudEvents-aligned APIs should declare an Apache-2.0 license.
$.info.license.name
error
cloudevents-server-https
All server URLs must use HTTPS.
$.servers[*].url
error
cloudevents-operation-id
Every operation must declare a unique operationId.
$.paths[*][get,post,put,patch,delete]
warn
cloudevents-operation-tags
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
cloudevents-operation-summary
Every operation must include a short summary.
$.paths[*][get,post,put,patch,delete]
warn
cloudevents-error-responses
Mutating operations should declare 4xx error responses.
$.paths[*][post,put,patch,delete].responses
warn
cloudevents-subscription-required-attributes
Subscription schemas must include the CloudEvents-required `id`, `source`, and `sink` attributes.
$.components.schemas.Subscription.properties

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas

# Spectral linting rules for the CloudEvents Subscriptions API and any
# OpenAPI describing CloudEvents-compliant endpoints.
rules:
  cloudevents-info-contact:
    description: API contact information must be present.
    severity: error
    given: "$.info"
    then:
      field: contact
      function: truthy

  cloudevents-info-license:
    description: API license must be declared (CloudEvents publishes under Apache-2.0).
    severity: warn
    given: "$.info"
    then:
      field: license
      function: truthy

  cloudevents-info-license-apache:
    description: CloudEvents-aligned APIs should declare an Apache-2.0 license.
    severity: warn
    given: "$.info.license.name"
    then:
      function: pattern
      functionOptions:
        match: "(?i)apache"

  cloudevents-server-https:
    description: All server URLs must use HTTPS.
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  cloudevents-operation-id:
    description: Every operation must declare a unique operationId.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  cloudevents-operation-tags:
    description: Every operation must declare at least one tag.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1

  cloudevents-operation-summary:
    description: Every operation must include a short summary.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  cloudevents-error-responses:
    description: Mutating operations should declare 4xx error responses.
    severity: warn
    given: "$.paths[*][post,put,patch,delete].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ["400"]
            - required: ["401"]
            - required: ["403"]
            - required: ["404"]

  cloudevents-subscription-required-attributes:
    description: Subscription schemas must include the CloudEvents-required `id`, `source`, and `sink` attributes.
    severity: warn
    given: "$.components.schemas.Subscription.properties"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required: ["id", "source", "sink"]

Work with this as data

Every ruleset here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This ruleset
curl "https://apis.io/api/v1/rules/cloudevents-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.