mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 00:26:34 +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 => {
|
||||
return (
|
||||
<SecurityRequirementAndWrap key={scheme.id}>
|
||||
<Link to={scheme.sectionId}>{scheme.id}</Link>
|
||||
<Link to={scheme.sectionId}>{scheme.displayName}</Link>
|
||||
{scheme.scopes.length > 0 && ' ('}
|
||||
{scheme.scopes.map(scope => (
|
||||
<ScopeName key={scope}>{scope}</ScopeName>
|
||||
|
|
|
@ -73,7 +73,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
|
|||
<MiddlePanel>
|
||||
<H2>
|
||||
<ShareLink to={scheme.sectionId} />
|
||||
{scheme.id}
|
||||
{scheme.displayName}
|
||||
</H2>
|
||||
<Markdown source={scheme.description || ''} />
|
||||
<StyledMarkdownBlock>
|
||||
|
|
|
@ -5,6 +5,7 @@ import { OpenAPIParser } from '../OpenAPIParser';
|
|||
export interface SecurityScheme extends OpenAPISecurityScheme {
|
||||
id: string;
|
||||
sectionId: string;
|
||||
displayName: string;
|
||||
scopes: string[];
|
||||
}
|
||||
|
||||
|
@ -23,11 +24,13 @@ export class SecurityRequirementModel {
|
|||
console.warn(`Non existing security scheme referenced: ${id}. Skipping`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const displayName = scheme['x-displayName'] || id;
|
||||
|
||||
return {
|
||||
...scheme,
|
||||
id,
|
||||
sectionId: SECURITY_SCHEMES_SECTION_PREFIX + id,
|
||||
displayName,
|
||||
scopes,
|
||||
};
|
||||
})
|
||||
|
|
|
@ -7,6 +7,7 @@ export class SecuritySchemeModel {
|
|||
sectionId: string;
|
||||
type: OpenAPISecurityScheme['type'];
|
||||
description: string;
|
||||
displayName: string;
|
||||
apiKey?: {
|
||||
name: string;
|
||||
in: OpenAPISecurityScheme['in'];
|
||||
|
@ -27,6 +28,7 @@ export class SecuritySchemeModel {
|
|||
this.id = id;
|
||||
this.sectionId = SECURITY_SCHEMES_SECTION_PREFIX + id;
|
||||
this.type = info.type;
|
||||
this.displayName = info['x-displayName'] || id;
|
||||
this.description = info.description || '';
|
||||
if (info.type === 'apiKey') {
|
||||
this.apiKey = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user