oas2-operation-security-defined
Operation "security" values must match a scheme defined in the "securityDefinitions" object.
- Applies to
security- Selects
#SecurityRequirementObject- Function
oasSecurityDefined- Specs
- OpenAPI 2.0
- Message
{{error}}
Use it
This rule ships with OpenLint in spectral:oas. Extending the ruleset turns it on:
extends: spectral:oas
rules:
oas2-operation-security-defined: warn # or off, or another severity
Definition
As defined in @openlint/openlint-rulesets. Functions show by name.
oas2-operation-security-defined:
description: >-
Operation "security" values must match a scheme defined in the
"securityDefinitions" object.
message: '{{error}}'
recommended: true
formats:
- OpenAPI 2.0 (Swagger)
given: '#SecurityRequirementObject'
then:
function: oasSecurityDefined
functionOptions:
oasVersion: 2
About this rule
Operation security values must match a scheme defined in the securityDefinitions object.
Ignores empty security values for cases where authentication is explicitly not required or optional.