Skip to content

Commit 5aa7784

Browse files
committed
fix: auth section appears twice
fixes #818
1 parent e787d9e commit 5aa7784

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/services/OpenAPIParser.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { OpenAPIRef, OpenAPISchema, OpenAPISpec, Referenced } from '../types';
44

55
import { appendToMdHeading, IS_BROWSER } from '../utils/';
66
import { JsonPointer } from '../utils/JsonPointer';
7-
import { isNamedDefinition, SECURITY_DEFINITIONS_COMPONENT_NAME } from '../utils/openapi';
7+
import {
8+
isNamedDefinition,
9+
SECURITY_DEFINITIONS_COMPONENT_NAME,
10+
SECURITY_DEFINITIONS_JSX_NAME,
11+
} from '../utils/openapi';
812
import { buildComponentComment, MarkdownRenderer } from './MarkdownRenderer';
913
import { RedocNormalizedOptions } from './RedocNormalizedOptions';
1014

@@ -74,7 +78,10 @@ export class OpenAPIParser {
7478
) {
7579
// Automatically inject Authentication section with SecurityDefinitions component
7680
const description = spec.info.description || '';
77-
if (!MarkdownRenderer.containsComponent(description, SECURITY_DEFINITIONS_COMPONENT_NAME)) {
81+
if (
82+
!MarkdownRenderer.containsComponent(description, SECURITY_DEFINITIONS_COMPONENT_NAME) &&
83+
!MarkdownRenderer.containsComponent(description, SECURITY_DEFINITIONS_JSX_NAME)
84+
) {
7885
const comment = buildComponentComment(SECURITY_DEFINITIONS_COMPONENT_NAME);
7986
spec.info.description = appendToMdHeading(description, 'Authentication', comment);
8087
}

0 commit comments

Comments
 (0)