|
1
|
import React from "react" |
|
2
|
import dynamic from "next/dynamic" |
|
3
|
import type { OpenAPI } from "types" |
|
4
|
import type { SecurityDescriptionProps } from "./Description" |
|
5
|
import { Fragment } from "react" |
|
6
|
|
|
7
|
const SecurityDescription = dynamic<SecurityDescriptionProps>( |
|
8
|
async () => import("./Description") |
|
9
|
) as React.FC<SecurityDescriptionProps> |
|
10
|
|
|
11
|
type SecurityProps = { |
|
12
|
specs?: OpenAPI.OpenAPIV3.Document |
|
13
|
} |
|
14
|
|
|
15
|
const Security = ({ specs }: SecurityProps) => { |
|
16
|
return ( |
|
17
|
<div> |
|
18
|
{specs && ( |
|
19
|
<> |
|
20
|
{Object.values(specs.components?.securitySchemes || {}).map( |
|
21
|
(securitySchema, index) => ( |
|
22
|
<Fragment key={index}> |
|
23
|
{!("$ref" in securitySchema) && ( |
|
24
|
<SecurityDescription securitySchema={securitySchema} /> |
|
25
|
)} |
|
26
|
</Fragment> |
|
27
|
) |
|
28
|
)} |
|
29
|
</> |
|
30
|
)} |
|
31
|
</div> |
|
32
|
) |
|
33
|
} |
|
34
|
|
|
35
|
export default Security |