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