Skip to content

Commit

Permalink
fix: undefined when security is defined, but not used on path (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdimascio committed Apr 18, 2021
1 parent a585ba1 commit 117d54b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/middlewares/openapi.request.validator.ts
Expand Up @@ -295,10 +295,8 @@ class Security {
apiDocs: OpenAPIV3.Document,
schema: OperationObject,
): string[] {
const hasPathSecurity =
schema.hasOwnProperty('security') && schema.security.length > 0;
const hasRootSecurity =
apiDocs.hasOwnProperty('security') && apiDocs.security.length > 0;
const hasPathSecurity = schema.security?.length > 0 ?? false;
const hasRootSecurity = apiDocs.security?.length > 0 ?? false;

let usedSecuritySchema: SecurityRequirementObject[] = [];
if (hasPathSecurity) {
Expand Down

0 comments on commit 117d54b

Please sign in to comment.