From 426e5b67abf499209cec0852526e7bd396f7a581 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 24 Nov 2017 11:49:32 +0200 Subject: [PATCH] fix: do not auto-append security-definitions if they are not in the spec --- src/services/OpenAPIParser.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index 39c32a1d..73867206 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -68,7 +68,12 @@ export class OpenAPIParser { } preprocess(spec: OpenAPISpec) { - if (!this.options.noAutoAuth && spec.info) { + if ( + !this.options.noAutoAuth && + spec.info && + spec.components && + spec.components.securitySchemes + ) { // Automatically inject Authentication section with SecurityDefinitions component const description = spec.info.description || ''; const securityRegexp = new RegExp(