spectral:oas warn on by default

oas3_1-callbacks-in-webhook

Applies to
callbacks
Selects
$.webhooks[*][*].callbacks
Function
undefined
Specs
OpenAPI 3.1OpenAPI 3.2
Message
Callbacks should not be defined in a webhook.

Use it

This rule ships with OpenLint in spectral:oas. Extending the ruleset turns it on:

extends: spectral:oas
rules:
  oas3_1-callbacks-in-webhook: warn   # or off, or another severity

Definition

As defined in @openlint/openlint-rulesets. Functions show by name.

oas3_1-callbacks-in-webhook:
  message: Callbacks should not be defined in a webhook.
  recommended: true
  formats:
    - OpenAPI 3.1.x
    - OpenAPI 3.2.x
  given:
    - '$.webhooks[*][*].callbacks'
  then:
    function: undefined

About this rule

Callbacks should not be defined in a webhook. Applies to OpenAPI v3.1 and v3.2.

Bad Example

webhooks:
  newPet:
    post:
      callbacks: ...

Sources