Fix security schemes representation

This commit is contained in:
Roman Hotsiy 2017-11-23 15:40:26 +02:00
parent 1994002685
commit 343f51a867
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -10,7 +10,7 @@ import { OpenAPISecurityScheme } from '../../types';
const AUTH_TYPES = {
oauth2: 'OAuth2',
apiKey: 'API Key',
basic: 'Basic Authorization',
http: 'HTTP',
openIdConnect: 'Open ID Connect',
};
@ -23,6 +23,10 @@ const AuthTable = styled.table`
ul > li {
margin: 0.5em 0 !important;
}
th {
text-transform: capitalize;
}
`;
export class OAuthFlow extends React.PureComponent<OAuthFlowProps> {
@ -84,7 +88,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
<tbody>
<tr>
<th> Security scheme type: </th>
<td> {AUTH_TYPES[scheme.type]} </td>
<td> {AUTH_TYPES[scheme.type] || scheme.type} </td>
</tr>
{scheme.apiKey ? (
<tr>
@ -93,14 +97,17 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
</tr>
) : scheme.http ? (
[
<tr>
<tr key="scheme">
<th> HTTP Authorization Scheme </th>
<th> {scheme.http.scheme} </th>
</tr>,
<tr>
<th> Bearer format </th>
<th> "{scheme.http.bearerFormat}" </th>
<td> {scheme.http.scheme} </td>
</tr>,
scheme.http.scheme === 'bearer' &&
scheme.http.bearerFormat && (
<tr key="bearer">
<th> Bearer format </th>
<td> "{scheme.http.bearerFormat}" </td>
</tr>
),
]
) : scheme.openId ? (
<tr>