Skip to content

Commit

Permalink
fix: restore old variant security injections (#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVarchuk authored Jul 18, 2022
1 parent 2970f95 commit 1a1bc26
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demo/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ info:
OAuth2 - an open protocol to allow secure authorization in a simple
and standard method from web, mobile and desktop applications.
<SecurityDefinitions />
<!-- ReDoc-Inject: <security-definitions> -->
version: 1.0.0
title: Swagger Petstore
Expand Down
12 changes: 11 additions & 1 deletion src/services/AppStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { SearchStore } from './SearchStore';

import { SchemaDefinition } from '../components/SchemaDefinition/SchemaDefinition';
import { SecurityDefs } from '../components/SecuritySchemes/SecuritySchemes';
import { SCHEMA_DEFINITION_JSX_NAME, SECURITY_DEFINITIONS_JSX_NAME } from '../utils/openapi';
import {
SCHEMA_DEFINITION_JSX_NAME,
SECURITY_DEFINITIONS_JSX_NAME,
OLD_SECURITY_DEFINITIONS_JSX_NAME,
} from '../utils/openapi';

import { IS_BROWSER } from '../utils';
import type { StoreState } from './types';
Expand Down Expand Up @@ -150,6 +154,12 @@ const DEFAULT_OPTIONS: RedocRawOptions = {
securitySchemes: store.spec.securitySchemes,
}),
},
[OLD_SECURITY_DEFINITIONS_JSX_NAME]: {
component: SecurityDefs,
propsSelector: (store: AppStore) => ({
securitySchemes: store.spec.securitySchemes,
}),
},
[SCHEMA_DEFINITION_JSX_NAME]: {
component: SchemaDefinition,
propsSelector: (store: AppStore) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ Petstore offers two forms of authentication:
OAuth2 - an open protocol to allow secure authorization in a simple
and standard method from web, mobile and desktop applications.
<SecurityDefinitions />
<!-- ReDoc-Inject: <security-definitions> -->
",
"license": Object {
"name": "Apache 2.0",
Expand Down
1 change: 1 addition & 0 deletions src/utils/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ export function normalizeServers(
}

export const SECURITY_DEFINITIONS_JSX_NAME = 'SecurityDefinitions';
export const OLD_SECURITY_DEFINITIONS_JSX_NAME = 'security-definitions';
export const SCHEMA_DEFINITION_JSX_NAME = 'SchemaDefinition';

export let SECURITY_SCHEMES_SECTION_PREFIX = 'section/Authentication/';
Expand Down

0 comments on commit 1a1bc26

Please sign in to comment.