mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-18 02:40:32 +03:00
use x-displayName in securityDefinitions (#1444)
Co-authored-by: elis-k <53352199+elis-k@users.noreply.github.com> Co-authored-by: AlexVarchuk <olexandr.varchuk@gmail.com>
This commit is contained in:
parent
29bbfbddbf
commit
ac6fb458a4
|
@ -70,7 +70,7 @@ export class SecurityRequirement extends React.PureComponent<SecurityRequirement
|
||||||
security.schemes.map(scheme => {
|
security.schemes.map(scheme => {
|
||||||
return (
|
return (
|
||||||
<SecurityRequirementAndWrap key={scheme.id}>
|
<SecurityRequirementAndWrap key={scheme.id}>
|
||||||
<Link to={scheme.sectionId}>{scheme.id}</Link>
|
<Link to={scheme.sectionId}>{scheme.displayName}</Link>
|
||||||
{scheme.scopes.length > 0 && ' ('}
|
{scheme.scopes.length > 0 && ' ('}
|
||||||
{scheme.scopes.map(scope => (
|
{scheme.scopes.map(scope => (
|
||||||
<ScopeName key={scope}>{scope}</ScopeName>
|
<ScopeName key={scope}>{scope}</ScopeName>
|
||||||
|
|
|
@ -73,7 +73,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
|
||||||
<MiddlePanel>
|
<MiddlePanel>
|
||||||
<H2>
|
<H2>
|
||||||
<ShareLink to={scheme.sectionId} />
|
<ShareLink to={scheme.sectionId} />
|
||||||
{scheme.id}
|
{scheme.displayName}
|
||||||
</H2>
|
</H2>
|
||||||
<Markdown source={scheme.description || ''} />
|
<Markdown source={scheme.description || ''} />
|
||||||
<StyledMarkdownBlock>
|
<StyledMarkdownBlock>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { OpenAPIParser } from '../OpenAPIParser';
|
||||||
export interface SecurityScheme extends OpenAPISecurityScheme {
|
export interface SecurityScheme extends OpenAPISecurityScheme {
|
||||||
id: string;
|
id: string;
|
||||||
sectionId: string;
|
sectionId: string;
|
||||||
|
displayName: string;
|
||||||
scopes: string[];
|
scopes: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,11 +24,13 @@ export class SecurityRequirementModel {
|
||||||
console.warn(`Non existing security scheme referenced: ${id}. Skipping`);
|
console.warn(`Non existing security scheme referenced: ${id}. Skipping`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
const displayName = scheme['x-displayName'] || id;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...scheme,
|
...scheme,
|
||||||
id,
|
id,
|
||||||
sectionId: SECURITY_SCHEMES_SECTION_PREFIX + id,
|
sectionId: SECURITY_SCHEMES_SECTION_PREFIX + id,
|
||||||
|
displayName,
|
||||||
scopes,
|
scopes,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,6 +7,7 @@ export class SecuritySchemeModel {
|
||||||
sectionId: string;
|
sectionId: string;
|
||||||
type: OpenAPISecurityScheme['type'];
|
type: OpenAPISecurityScheme['type'];
|
||||||
description: string;
|
description: string;
|
||||||
|
displayName: string;
|
||||||
apiKey?: {
|
apiKey?: {
|
||||||
name: string;
|
name: string;
|
||||||
in: OpenAPISecurityScheme['in'];
|
in: OpenAPISecurityScheme['in'];
|
||||||
|
@ -27,6 +28,7 @@ export class SecuritySchemeModel {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.sectionId = SECURITY_SCHEMES_SECTION_PREFIX + id;
|
this.sectionId = SECURITY_SCHEMES_SECTION_PREFIX + id;
|
||||||
this.type = info.type;
|
this.type = info.type;
|
||||||
|
this.displayName = info['x-displayName'] || id;
|
||||||
this.description = info.description || '';
|
this.description = info.description || '';
|
||||||
if (info.type === 'apiKey') {
|
if (info.type === 'apiKey') {
|
||||||
this.apiKey = {
|
this.apiKey = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user