Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore old variant security injections #2075

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -12,7 +12,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';

Expand Down Expand Up @@ -160,6 +164,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 @@ -627,6 +627,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