Skip to content

Commit

Permalink
fix: do not auto-append security-definitions if they are not in the spec
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Nov 24, 2017
1 parent ca81b6d commit 426e5b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/services/OpenAPIParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 426e5b6

Please sign in to comment.