diff --git a/packages/rulesets/src/oas/__tests__/oas3-operation-security-defined.test.ts b/packages/rulesets/src/oas/__tests__/oas3-operation-security-defined.test.ts index 2046871f7..d62ea278e 100644 --- a/packages/rulesets/src/oas/__tests__/oas3-operation-security-defined.test.ts +++ b/packages/rulesets/src/oas/__tests__/oas3-operation-security-defined.test.ts @@ -35,6 +35,50 @@ testRule('oas3-operation-security-defined', [ errors: [], }, + { + name: 'valid OpenAPI 3.1 operation with optional security alternatives', + document: { + openapi: '3.1.0', + components: { + securitySchemes: { + apiKey: { + type: 'apiKey', + name: 'x-api-key', + in: 'header', + }, + oauthBearer: { + type: 'http', + scheme: 'bearer', + }, + }, + }, + security: [ + { + apiKey: [], + }, + { + oauthBearer: [], + }, + ], + paths: { + '/tweets/search': { + get: { + security: [ + { + apiKey: [], + }, + { + oauthBearer: [], + }, + {}, + ], + }, + }, + }, + }, + errors: [], + }, + { name: 'valid and invalid object', document: {