diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index 39c32a1d1d..73867206d2 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(