spectral:oas warn on by default

oas2-anyOf

anyOf is not available in OpenAPI v2, it was added in OpenAPI v3

Applies to
anyOf
Selects
$..anyOf
Function
undefined
Specs
OpenAPI 2.0
Message
"anyOf" keyword must not be used in OpenAPI v2 document.

Use it

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

extends: spectral:oas
rules:
  oas2-anyOf: warn   # or off, or another severity

Definition

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

oas2-anyOf:
  description: 'anyOf is not available in OpenAPI v2, it was added in OpenAPI v3'
  message: '"anyOf" keyword must not be used in OpenAPI v2 document.'
  recommended: true
  formats:
    - OpenAPI 2.0 (Swagger)
  given: $..anyOf
  then:
    function: undefined

About this rule

OpenAPI v3 keyword anyOf detected in OpenAPI v2 document.

Sources