docusaurus-theme-openapi-docs 0.0.0-1000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/babel.config.js +35 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +81 -0
- package/lib/markdown/createDescription.d.ts +1 -0
- package/lib/markdown/createDescription.js +15 -0
- package/lib/markdown/schema.d.ts +3 -0
- package/lib/markdown/schema.js +149 -0
- package/lib/markdown/utils.d.ts +10 -0
- package/lib/markdown/utils.js +49 -0
- package/lib/markdown/utils.test.d.ts +1 -0
- package/lib/markdown/utils.test.js +43 -0
- package/lib/theme/ApiExplorer/Accept/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Accept/index.js +38 -0
- package/lib/theme/ApiExplorer/Accept/slice.d.ts +11 -0
- package/lib/theme/ApiExplorer/Accept/slice.js +22 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +35 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +41 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +153 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +147 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +58 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +248 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +59 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +51 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +110 -0
- package/lib/theme/ApiExplorer/Authorization/auth-types.d.ts +3 -0
- package/lib/theme/ApiExplorer/Authorization/auth-types.js +28 -0
- package/lib/theme/ApiExplorer/Authorization/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Authorization/index.js +160 -0
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +40 -0
- package/lib/theme/ApiExplorer/Authorization/slice.js +102 -0
- package/lib/theme/ApiExplorer/Body/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/Body/index.js +381 -0
- package/lib/theme/ApiExplorer/Body/json2xml.js +43 -0
- package/lib/theme/ApiExplorer/Body/slice.d.ts +82 -0
- package/lib/theme/ApiExplorer/Body/slice.js +97 -0
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +389 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +95 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +501 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +271 -0
- package/lib/theme/ApiExplorer/ContentType/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ContentType/index.js +40 -0
- package/lib/theme/ApiExplorer/ContentType/slice.d.ts +11 -0
- package/lib/theme/ApiExplorer/ContentType/slice.js +22 -0
- package/lib/theme/ApiExplorer/Export/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Export/index.js +57 -0
- package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
- package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +8 -0
- package/lib/theme/ApiExplorer/FloatingButton/index.js +28 -0
- package/lib/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
- package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/FormFileUpload/index.js +173 -0
- package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/FormItem/index.js +44 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/index.js +51 -0
- package/lib/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +8 -0
- package/lib/theme/ApiExplorer/FormSelect/index.js +35 -0
- package/lib/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.js +73 -0
- package/lib/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
- package/lib/theme/ApiExplorer/LiveEditor/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/LiveEditor/index.js +168 -0
- package/lib/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
- package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +8 -0
- package/lib/theme/ApiExplorer/MethodEndpoint/index.js +86 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +220 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +63 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +89 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +63 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +38 -0
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ParamOptions/index.js +223 -0
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +17 -0
- package/lib/theme/ApiExplorer/ParamOptions/slice.js +25 -0
- package/lib/theme/ApiExplorer/Request/_Request.scss +129 -0
- package/lib/theme/ApiExplorer/Request/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/Request/index.js +396 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.js +222 -0
- package/lib/theme/ApiExplorer/Response/_Response.scss +121 -0
- package/lib/theme/ApiExplorer/Response/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/Response/index.js +193 -0
- package/lib/theme/ApiExplorer/Response/slice.d.ts +17 -0
- package/lib/theme/ApiExplorer/Response/slice.js +51 -0
- package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +380 -0
- package/lib/theme/ApiExplorer/Server/_Server.scss +26 -0
- package/lib/theme/ApiExplorer/Server/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Server/index.js +199 -0
- package/lib/theme/ApiExplorer/Server/slice.d.ts +13 -0
- package/lib/theme/ApiExplorer/Server/slice.js +33 -0
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +20 -0
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +465 -0
- package/lib/theme/ApiExplorer/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/index.js +41 -0
- package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +3 -0
- package/lib/theme/ApiExplorer/persistanceMiddleware.js +54 -0
- package/lib/theme/ApiExplorer/storage-utils.d.ts +4 -0
- package/lib/theme/ApiExplorer/storage-utils.js +41 -0
- package/lib/theme/ApiItem/Layout/index.d.ts +3 -0
- package/lib/theme/ApiItem/Layout/index.js +121 -0
- package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
- package/lib/theme/ApiItem/hooks.d.ts +12 -0
- package/lib/theme/ApiItem/hooks.js +13 -0
- package/lib/theme/ApiItem/index.d.ts +2 -0
- package/lib/theme/ApiItem/index.js +238 -0
- package/lib/theme/ApiItem/store.d.ts +46 -0
- package/lib/theme/ApiItem/store.js +53 -0
- package/lib/theme/ApiLogo/index.d.ts +2 -0
- package/lib/theme/ApiLogo/index.js +51 -0
- package/lib/theme/ApiTabs/_ApiTabs.scss +142 -0
- package/lib/theme/ApiTabs/index.d.ts +7 -0
- package/lib/theme/ApiTabs/index.js +270 -0
- package/lib/theme/ArrayBrackets/index.d.ts +3 -0
- package/lib/theme/ArrayBrackets/index.js +50 -0
- package/lib/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
- package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
- package/lib/theme/DiscriminatorTabs/index.js +258 -0
- package/lib/theme/Markdown/Details/_Details.scss +122 -0
- package/lib/theme/Markdown/index.js +179 -0
- package/lib/theme/MimeTabs/_MimeTabs.scss +70 -0
- package/lib/theme/MimeTabs/index.d.ts +6 -0
- package/lib/theme/MimeTabs/index.js +286 -0
- package/lib/theme/OperationTabs/_OperationTabs.scss +72 -0
- package/lib/theme/OperationTabs/index.d.ts +3 -0
- package/lib/theme/OperationTabs/index.js +248 -0
- package/lib/theme/ParamsDetails/index.d.ts +6 -0
- package/lib/theme/ParamsDetails/index.js +85 -0
- package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/lib/theme/ParamsItem/index.d.ts +25 -0
- package/lib/theme/ParamsItem/index.js +218 -0
- package/lib/theme/RequestSchema/index.d.ts +15 -0
- package/lib/theme/RequestSchema/index.js +194 -0
- package/lib/theme/ResponseExamples/index.d.ts +18 -0
- package/lib/theme/ResponseExamples/index.js +193 -0
- package/lib/theme/ResponseHeaders/index.d.ts +13 -0
- package/lib/theme/ResponseHeaders/index.js +39 -0
- package/lib/theme/ResponseSamples/_ResponseSamples.scss +3 -0
- package/lib/theme/ResponseSamples/index.d.ts +8 -0
- package/lib/theme/ResponseSamples/index.js +27 -0
- package/lib/theme/ResponseSchema/index.d.ts +15 -0
- package/lib/theme/ResponseSchema/index.js +159 -0
- package/lib/theme/Schema/index.d.ts +8 -0
- package/lib/theme/Schema/index.js +885 -0
- package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +213 -0
- package/lib/theme/SchemaTabs/_SchemaTabs.scss +61 -0
- package/lib/theme/SchemaTabs/index.d.ts +3 -0
- package/lib/theme/SchemaTabs/index.js +255 -0
- package/lib/theme/SkeletonLoader/index.d.ts +6 -0
- package/lib/theme/SkeletonLoader/index.js +20 -0
- package/lib/theme/StatusCodes/index.d.ts +9 -0
- package/lib/theme/StatusCodes/index.js +81 -0
- package/lib/theme/styles.scss +212 -0
- package/lib/types.d.ts +157 -0
- package/lib/types.js +8 -0
- package/package.json +83 -0
- package/src/index.ts +85 -0
- package/src/markdown/createDescription.ts +13 -0
- package/src/markdown/schema.ts +181 -0
- package/src/markdown/utils.test.ts +49 -0
- package/src/markdown/utils.ts +59 -0
- package/src/plugin-content-docs.d.ts +20 -0
- package/src/postman-code-generators.d.ts +9 -0
- package/src/react-magic-dropzone.d.ts +9 -0
- package/src/theme/ApiExplorer/Accept/index.tsx +36 -0
- package/src/theme/ApiExplorer/Accept/slice.ts +29 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +32 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx +34 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +134 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx +79 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx +55 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx +166 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +48 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx +54 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +45 -0
- package/src/theme/ApiExplorer/Authorization/auth-types.ts +30 -0
- package/src/theme/ApiExplorer/Authorization/index.tsx +158 -0
- package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
- package/src/theme/ApiExplorer/Body/index.tsx +376 -0
- package/src/theme/ApiExplorer/Body/json2xml.js +43 -0
- package/src/theme/ApiExplorer/Body/slice.ts +133 -0
- package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +57 -0
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +338 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +96 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +501 -0
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +248 -0
- package/src/theme/ApiExplorer/ContentType/index.tsx +38 -0
- package/src/theme/ApiExplorer/ContentType/slice.ts +29 -0
- package/src/theme/ApiExplorer/Export/index.tsx +47 -0
- package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
- package/src/theme/ApiExplorer/FloatingButton/index.tsx +29 -0
- package/src/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
- package/src/theme/ApiExplorer/FormFileUpload/index.tsx +119 -0
- package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
- package/src/theme/ApiExplorer/FormItem/index.tsx +33 -0
- package/src/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
- package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +57 -0
- package/src/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
- package/src/theme/ApiExplorer/FormSelect/index.tsx +38 -0
- package/src/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +80 -0
- package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +114 -0
- package/src/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
- package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +91 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +175 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +64 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +86 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +65 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +38 -0
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +146 -0
- package/src/theme/ApiExplorer/ParamOptions/slice.ts +37 -0
- package/src/theme/ApiExplorer/Request/_Request.scss +129 -0
- package/src/theme/ApiExplorer/Request/index.tsx +309 -0
- package/src/theme/ApiExplorer/Request/makeRequest.ts +254 -0
- package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
- package/src/theme/ApiExplorer/Response/index.tsx +157 -0
- package/src/theme/ApiExplorer/Response/slice.ts +52 -0
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +287 -0
- package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
- package/src/theme/ApiExplorer/Server/index.tsx +130 -0
- package/src/theme/ApiExplorer/Server/slice.ts +39 -0
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +526 -0
- package/src/theme/ApiExplorer/index.tsx +41 -0
- package/src/theme/ApiExplorer/persistanceMiddleware.ts +71 -0
- package/src/theme/ApiExplorer/postman-collection.d.ts +10 -0
- package/src/theme/ApiExplorer/react-modal.d.ts +8 -0
- package/src/theme/ApiExplorer/storage-utils.ts +39 -0
- package/src/theme/ApiItem/Layout/index.tsx +85 -0
- package/src/theme/ApiItem/Layout/styles.module.css +17 -0
- package/src/theme/ApiItem/hooks.ts +13 -0
- package/src/theme/ApiItem/index.tsx +222 -0
- package/src/theme/ApiItem/store.ts +51 -0
- package/src/theme/ApiLogo/index.tsx +52 -0
- package/src/theme/ApiTabs/_ApiTabs.scss +142 -0
- package/src/theme/ApiTabs/index.tsx +238 -0
- package/src/theme/ArrayBrackets/index.tsx +37 -0
- package/src/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
- package/src/theme/DiscriminatorTabs/index.tsx +229 -0
- package/src/theme/Markdown/Details/_Details.scss +122 -0
- package/src/theme/Markdown/index.js +179 -0
- package/src/theme/MimeTabs/_MimeTabs.scss +70 -0
- package/src/theme/MimeTabs/index.tsx +257 -0
- package/src/theme/OperationTabs/_OperationTabs.scss +72 -0
- package/src/theme/OperationTabs/index.tsx +220 -0
- package/src/theme/ParamsDetails/index.tsx +81 -0
- package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/src/theme/ParamsItem/index.tsx +205 -0
- package/src/theme/RequestSchema/index.tsx +157 -0
- package/src/theme/ResponseExamples/index.tsx +192 -0
- package/src/theme/ResponseHeaders/index.tsx +49 -0
- package/src/theme/ResponseSamples/_ResponseSamples.scss +3 -0
- package/src/theme/ResponseSamples/index.tsx +31 -0
- package/src/theme/ResponseSchema/index.tsx +144 -0
- package/src/theme/Schema/index.tsx +939 -0
- package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/src/theme/SchemaItem/index.tsx +198 -0
- package/src/theme/SchemaTabs/_SchemaTabs.scss +61 -0
- package/src/theme/SchemaTabs/index.tsx +224 -0
- package/src/theme/SkeletonLoader/index.tsx +18 -0
- package/src/theme/StatusCodes/index.tsx +72 -0
- package/src/theme/styles.scss +212 -0
- package/src/theme-classic.d.ts +80 -0
- package/src/theme-openapi.d.ts +288 -0
- package/src/theme-translations.d.ts +9 -0
- package/src/types.ts +182 -0
- package/tsconfig.json +16 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
.openapi-schema__container {
|
|
2
|
+
&:hover {
|
|
3
|
+
.openapi-schema__property {
|
|
4
|
+
color: var(--ifm-color-primary);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.openapi-schema__list-item {
|
|
10
|
+
list-style: none;
|
|
11
|
+
position: relative;
|
|
12
|
+
margin: 0 !important;
|
|
13
|
+
padding: 5px 0 5px 1rem;
|
|
14
|
+
border-left: thin solid var(--openapi-tree-line-color) !important;
|
|
15
|
+
|
|
16
|
+
// Horizontal line styling for schema properties
|
|
17
|
+
&::before {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 10px;
|
|
20
|
+
left: 0;
|
|
21
|
+
width: 0.7rem;
|
|
22
|
+
/* width of horizontal line */
|
|
23
|
+
height: 0.5rem;
|
|
24
|
+
/* vertical position of line */
|
|
25
|
+
vertical-align: top;
|
|
26
|
+
border-bottom: thin solid var(--openapi-tree-line-color);
|
|
27
|
+
content: "";
|
|
28
|
+
display: inline-block;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.openapi-schema__name {
|
|
33
|
+
opacity: 0.6;
|
|
34
|
+
padding-left: 0.3rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.openapi-schema__required {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
font-size: 10.5px;
|
|
41
|
+
font-weight: bold;
|
|
42
|
+
text-transform: uppercase;
|
|
43
|
+
color: var(--openapi-required);
|
|
44
|
+
margin-left: 1%;
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.openapi-schema__deprecated {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
font-size: 10.5px;
|
|
52
|
+
font-weight: bold;
|
|
53
|
+
text-transform: uppercase;
|
|
54
|
+
color: var(--openapi-deprecated);
|
|
55
|
+
margin-left: 1%;
|
|
56
|
+
background-color: transparent;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.openapi-schema__nullable {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
font-size: 10.5px;
|
|
63
|
+
font-weight: bold;
|
|
64
|
+
text-transform: uppercase;
|
|
65
|
+
color: var(--openapi-nullable);
|
|
66
|
+
margin-left: 1%;
|
|
67
|
+
background-color: transparent;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.openapi-schema__strikethrough {
|
|
71
|
+
text-decoration: line-through;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.openapi-schema__property {
|
|
75
|
+
margin-top: 1.25px;
|
|
76
|
+
font-family: var(--ifm-font-family-monospace);
|
|
77
|
+
transition: 300ms;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.openapi-schema__divider {
|
|
81
|
+
flex-grow: 1;
|
|
82
|
+
border-bottom: thin solid var(--ifm-toc-border-color);
|
|
83
|
+
margin: 10px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.openapi-schema__container {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React, { ReactNode } from "react";
|
|
9
|
+
|
|
10
|
+
import Markdown from "@theme/Markdown";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
|
|
13
|
+
import { guard } from "../../markdown/utils";
|
|
14
|
+
|
|
15
|
+
export interface Props {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
collapsible?: boolean;
|
|
18
|
+
name?: string;
|
|
19
|
+
qualifierMessage?: string | undefined;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
schemaName?: string;
|
|
22
|
+
// TODO should probably be typed
|
|
23
|
+
schema?: any;
|
|
24
|
+
discriminator?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const transformEnumDescriptions = (
|
|
28
|
+
enumDescriptions?: Record<string, string>
|
|
29
|
+
) => {
|
|
30
|
+
if (enumDescriptions) {
|
|
31
|
+
return Object.entries(enumDescriptions);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return [];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getEnumDescriptionMarkdown = (enumDescriptions?: [string, string][]) => {
|
|
38
|
+
if (enumDescriptions?.length) {
|
|
39
|
+
return `| Enum Value | Description |
|
|
40
|
+
| ---- | ----- |
|
|
41
|
+
${enumDescriptions
|
|
42
|
+
.map((desc) => {
|
|
43
|
+
return `| ${desc[0]} | ${desc[1]} | `.replaceAll("\n", "<br/>");
|
|
44
|
+
})
|
|
45
|
+
.join("\n")}
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return "";
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default function SchemaItem(props: Props) {
|
|
53
|
+
const {
|
|
54
|
+
children: collapsibleSchemaContent,
|
|
55
|
+
collapsible,
|
|
56
|
+
name,
|
|
57
|
+
qualifierMessage,
|
|
58
|
+
required,
|
|
59
|
+
schemaName,
|
|
60
|
+
schema,
|
|
61
|
+
} = props;
|
|
62
|
+
let deprecated;
|
|
63
|
+
let schemaDescription;
|
|
64
|
+
let defaultValue: string | undefined;
|
|
65
|
+
let example: string | undefined;
|
|
66
|
+
let nullable;
|
|
67
|
+
let enumDescriptions: [string, string][] = [];
|
|
68
|
+
|
|
69
|
+
if (schema) {
|
|
70
|
+
deprecated = schema.deprecated;
|
|
71
|
+
schemaDescription = schema.description;
|
|
72
|
+
enumDescriptions = transformEnumDescriptions(schema["x-enumDescriptions"]);
|
|
73
|
+
defaultValue = schema.default;
|
|
74
|
+
example = schema.example;
|
|
75
|
+
nullable =
|
|
76
|
+
schema.nullable ||
|
|
77
|
+
(Array.isArray(schema.type) && schema.type.includes("null")); // support JSON Schema nullable
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const renderRequired = guard(
|
|
81
|
+
Array.isArray(required) ? required.includes(name) : required,
|
|
82
|
+
() => <span className="openapi-schema__required">required</span>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const renderDeprecated = guard(deprecated, () => (
|
|
86
|
+
<span className="openapi-schema__deprecated">deprecated</span>
|
|
87
|
+
));
|
|
88
|
+
|
|
89
|
+
const renderNullable = guard(nullable, () => (
|
|
90
|
+
<span className="openapi-schema__nullable">nullable</span>
|
|
91
|
+
));
|
|
92
|
+
|
|
93
|
+
const renderEnumDescriptions = guard(
|
|
94
|
+
getEnumDescriptionMarkdown(enumDescriptions),
|
|
95
|
+
(value) => {
|
|
96
|
+
return (
|
|
97
|
+
<div style={{ marginTop: ".5rem" }}>
|
|
98
|
+
<Markdown>{value}</Markdown>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const renderSchemaDescription = guard(schemaDescription, (description) => (
|
|
105
|
+
<>
|
|
106
|
+
<Markdown>{description}</Markdown>
|
|
107
|
+
</>
|
|
108
|
+
));
|
|
109
|
+
|
|
110
|
+
const renderQualifierMessage = guard(qualifierMessage, (message) => (
|
|
111
|
+
<>
|
|
112
|
+
<Markdown>{message}</Markdown>
|
|
113
|
+
</>
|
|
114
|
+
));
|
|
115
|
+
|
|
116
|
+
function renderDefaultValue() {
|
|
117
|
+
if (defaultValue !== undefined) {
|
|
118
|
+
if (typeof defaultValue === "string") {
|
|
119
|
+
return (
|
|
120
|
+
<div>
|
|
121
|
+
<strong>Default value: </strong>
|
|
122
|
+
<span>
|
|
123
|
+
<code>{defaultValue}</code>
|
|
124
|
+
</span>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
return (
|
|
129
|
+
<div>
|
|
130
|
+
<strong>Default value: </strong>
|
|
131
|
+
<span>
|
|
132
|
+
<code>{JSON.stringify(defaultValue)}</code>
|
|
133
|
+
</span>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function renderExample() {
|
|
141
|
+
if (example !== undefined) {
|
|
142
|
+
if (typeof example === "string") {
|
|
143
|
+
return (
|
|
144
|
+
<div>
|
|
145
|
+
<strong>Example: </strong>
|
|
146
|
+
<span>
|
|
147
|
+
<code>{example}</code>
|
|
148
|
+
</span>
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
return (
|
|
153
|
+
<div>
|
|
154
|
+
<strong>Example: </strong>
|
|
155
|
+
<span>
|
|
156
|
+
<code>{JSON.stringify(example)}</code>
|
|
157
|
+
</span>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const schemaContent = (
|
|
165
|
+
<div>
|
|
166
|
+
<span className="openapi-schema__container">
|
|
167
|
+
<strong
|
|
168
|
+
className={clsx("openapi-schema__property", {
|
|
169
|
+
"openapi-schema__strikethrough": deprecated,
|
|
170
|
+
})}
|
|
171
|
+
>
|
|
172
|
+
{name}
|
|
173
|
+
</strong>
|
|
174
|
+
<span className="openapi-schema__name">
|
|
175
|
+
{Array.isArray(schemaName) ? schemaName.join(" | ") : schemaName}
|
|
176
|
+
</span>
|
|
177
|
+
{(nullable || required || deprecated) && (
|
|
178
|
+
<span className="openapi-schema__divider"></span>
|
|
179
|
+
)}
|
|
180
|
+
{renderNullable}
|
|
181
|
+
{renderRequired}
|
|
182
|
+
{renderDeprecated}
|
|
183
|
+
</span>
|
|
184
|
+
{renderSchemaDescription}
|
|
185
|
+
{renderEnumDescriptions}
|
|
186
|
+
{renderQualifierMessage}
|
|
187
|
+
{renderDefaultValue()}
|
|
188
|
+
{renderExample()}
|
|
189
|
+
{collapsibleSchemaContent ?? collapsibleSchemaContent}
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<div className="openapi-schema__list-item">
|
|
195
|
+
{collapsible ? collapsibleSchemaContent : schemaContent}
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.openapi-tabs__schema-item {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
padding: 0.35rem 0.7rem;
|
|
13
|
+
border: 1px solid transparent;
|
|
14
|
+
margin-top: 0 !important;
|
|
15
|
+
margin-right: 0.5rem;
|
|
16
|
+
font-weight: var(--ifm-font-weight-bold);
|
|
17
|
+
font-family: var(--ifm-font-family-monospace);
|
|
18
|
+
font-size: 10px;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
transition: 300ms;
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
border: 1px solid var(--ifm-toc-border-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.active {
|
|
28
|
+
border: 1px solid var(--ifm-color-primary);
|
|
29
|
+
color: var(--ifm-color-primary);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:last-child {
|
|
33
|
+
margin-right: 0 !important;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.openapi-tabs__schema-list-container {
|
|
38
|
+
overflow-y: hidden;
|
|
39
|
+
overflow-x: scroll;
|
|
40
|
+
scroll-behavior: smooth;
|
|
41
|
+
scrollbar-width: none;
|
|
42
|
+
|
|
43
|
+
&::-webkit-scrollbar {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.active {
|
|
48
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.openapi-tabs__schema-label {
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.openapi-tabs__schema-tabs-container {
|
|
57
|
+
width: 100%;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React, {
|
|
9
|
+
cloneElement,
|
|
10
|
+
useRef,
|
|
11
|
+
useEffect,
|
|
12
|
+
useState,
|
|
13
|
+
ReactElement,
|
|
14
|
+
LegacyRef,
|
|
15
|
+
} from "react";
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
sanitizeTabsChildren,
|
|
19
|
+
TabProps,
|
|
20
|
+
useScrollPositionBlocker,
|
|
21
|
+
useTabs,
|
|
22
|
+
} from "@docusaurus/theme-common/internal";
|
|
23
|
+
import { TabItemProps } from "@docusaurus/theme-common/lib/utils/tabsUtils";
|
|
24
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
25
|
+
import clsx from "clsx";
|
|
26
|
+
import flatten from "lodash/flatten";
|
|
27
|
+
|
|
28
|
+
function TabList({
|
|
29
|
+
className,
|
|
30
|
+
block,
|
|
31
|
+
selectedValue,
|
|
32
|
+
selectValue,
|
|
33
|
+
tabValues,
|
|
34
|
+
}: TabProps & ReturnType<typeof useTabs>) {
|
|
35
|
+
const tabRefs: (HTMLLIElement | null)[] = [];
|
|
36
|
+
const { blockElementScrollPositionUntilNextRender } =
|
|
37
|
+
useScrollPositionBlocker();
|
|
38
|
+
|
|
39
|
+
const handleTabChange = (
|
|
40
|
+
event:
|
|
41
|
+
| React.FocusEvent<HTMLLIElement>
|
|
42
|
+
| React.MouseEvent<HTMLLIElement>
|
|
43
|
+
| React.KeyboardEvent<HTMLLIElement>
|
|
44
|
+
) => {
|
|
45
|
+
const newTab = event.currentTarget;
|
|
46
|
+
const newTabIndex = tabRefs.indexOf(newTab);
|
|
47
|
+
const newTabValue = tabValues[newTabIndex].value;
|
|
48
|
+
|
|
49
|
+
if (newTabValue !== selectedValue) {
|
|
50
|
+
blockElementScrollPositionUntilNextRender(newTab);
|
|
51
|
+
selectValue(newTabValue);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleKeydown = (event: React.KeyboardEvent<HTMLLIElement>) => {
|
|
56
|
+
let focusElement: HTMLLIElement | null = null;
|
|
57
|
+
|
|
58
|
+
switch (event.key) {
|
|
59
|
+
case "Enter": {
|
|
60
|
+
handleTabChange(event);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case "ArrowRight": {
|
|
64
|
+
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
65
|
+
focusElement = tabRefs[nextTab] ?? tabRefs[0]!;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "ArrowLeft": {
|
|
69
|
+
const prevTab = tabRefs.indexOf(event.currentTarget) - 1;
|
|
70
|
+
focusElement = tabRefs[prevTab] ?? tabRefs[tabRefs.length - 1]!;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
default:
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
focusElement?.focus();
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const tabItemListContainerRef = useRef<HTMLUListElement>(null);
|
|
81
|
+
const [showTabArrows, setShowTabArrows] = useState<boolean>(false);
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
85
|
+
for (let entry of entries) {
|
|
86
|
+
requestAnimationFrame(() => {
|
|
87
|
+
if (entry.target.clientWidth < entry.target.scrollWidth) {
|
|
88
|
+
setShowTabArrows(true);
|
|
89
|
+
} else {
|
|
90
|
+
setShowTabArrows(false);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
resizeObserver.observe(tabItemListContainerRef.current!);
|
|
97
|
+
|
|
98
|
+
return () => {
|
|
99
|
+
resizeObserver.disconnect();
|
|
100
|
+
};
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
103
|
+
const handleRightClick = (e: any) => {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
if (tabItemListContainerRef.current) {
|
|
106
|
+
tabItemListContainerRef.current.scrollLeft += 90;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const handleLeftClick = (e: any) => {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
if (tabItemListContainerRef.current) {
|
|
113
|
+
tabItemListContainerRef.current.scrollLeft -= 90;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div className="openapi-tabs__schema-tabs-container">
|
|
119
|
+
{showTabArrows && (
|
|
120
|
+
<button
|
|
121
|
+
className="openapi-tabs__arrow left"
|
|
122
|
+
onClick={handleLeftClick}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
<ul
|
|
126
|
+
ref={tabItemListContainerRef as LegacyRef<HTMLUListElement>}
|
|
127
|
+
role="tablist"
|
|
128
|
+
aria-orientation="horizontal"
|
|
129
|
+
className={clsx(
|
|
130
|
+
"openapi-tabs__schema-list-container",
|
|
131
|
+
"tabs",
|
|
132
|
+
{
|
|
133
|
+
"tabs--block": block,
|
|
134
|
+
},
|
|
135
|
+
className
|
|
136
|
+
)}
|
|
137
|
+
>
|
|
138
|
+
{tabValues.map(({ value, label, attributes }) => (
|
|
139
|
+
<li
|
|
140
|
+
// TODO extract TabListItem
|
|
141
|
+
role="tab"
|
|
142
|
+
tabIndex={selectedValue === value ? 0 : -1}
|
|
143
|
+
aria-selected={selectedValue === value}
|
|
144
|
+
key={value}
|
|
145
|
+
ref={(tabControl) => {
|
|
146
|
+
tabRefs.push(tabControl);
|
|
147
|
+
}}
|
|
148
|
+
onKeyDown={handleKeydown}
|
|
149
|
+
onClick={handleTabChange}
|
|
150
|
+
{...attributes}
|
|
151
|
+
className={clsx(
|
|
152
|
+
"tabs__item",
|
|
153
|
+
"openapi-tabs__schema-item",
|
|
154
|
+
attributes?.className as string,
|
|
155
|
+
{
|
|
156
|
+
active: selectedValue === value,
|
|
157
|
+
}
|
|
158
|
+
)}
|
|
159
|
+
>
|
|
160
|
+
<span className="openapi-tabs__schema-label">{label ?? value}</span>
|
|
161
|
+
</li>
|
|
162
|
+
))}
|
|
163
|
+
</ul>
|
|
164
|
+
{showTabArrows && (
|
|
165
|
+
<button
|
|
166
|
+
className="openapi-tabs__arrow right"
|
|
167
|
+
onClick={handleRightClick}
|
|
168
|
+
/>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function TabContent({
|
|
174
|
+
lazy,
|
|
175
|
+
children,
|
|
176
|
+
selectedValue,
|
|
177
|
+
}: TabProps & ReturnType<typeof useTabs>) {
|
|
178
|
+
const childTabs = (Array.isArray(children) ? children : [children]).filter(
|
|
179
|
+
Boolean
|
|
180
|
+
) as ReactElement<TabItemProps>[];
|
|
181
|
+
const flattenedChildTabs = flatten(childTabs);
|
|
182
|
+
if (lazy) {
|
|
183
|
+
const selectedTabItem = flattenedChildTabs.find(
|
|
184
|
+
(tabItem) => tabItem.props.value === selectedValue
|
|
185
|
+
);
|
|
186
|
+
if (!selectedTabItem) {
|
|
187
|
+
// fail-safe or fail-fast? not sure what's best here
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return cloneElement(selectedTabItem, { className: "margin-top--md" });
|
|
191
|
+
}
|
|
192
|
+
return (
|
|
193
|
+
<div className="margin-top--md">
|
|
194
|
+
{childTabs.map((tabItem, i) =>
|
|
195
|
+
cloneElement(tabItem, {
|
|
196
|
+
key: i,
|
|
197
|
+
hidden: tabItem.props.value !== selectedValue,
|
|
198
|
+
})
|
|
199
|
+
)}
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
function TabsComponent(props: TabProps): React.JSX.Element {
|
|
204
|
+
const tabs = useTabs(props);
|
|
205
|
+
return (
|
|
206
|
+
<div className="openapi-tabs__schema-container">
|
|
207
|
+
<TabList {...props} {...tabs} />
|
|
208
|
+
<TabContent {...props} {...tabs} />
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
export default function SchemaTabs(props: TabProps): React.JSX.Element {
|
|
213
|
+
const isBrowser = useIsBrowser();
|
|
214
|
+
return (
|
|
215
|
+
<TabsComponent
|
|
216
|
+
// Remount tabs after hydration
|
|
217
|
+
// Temporary fix for https://github.com/facebook/docusaurus/issues/5653
|
|
218
|
+
key={String(isBrowser)}
|
|
219
|
+
{...props}
|
|
220
|
+
>
|
|
221
|
+
{sanitizeTabsChildren(props.children)}
|
|
222
|
+
</TabsComponent>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const SkeletonLoader: React.FC<Props> = (props) => {
|
|
15
|
+
return <div className={`openapi-skeleton ${props.size ?? "md"}`}></div>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default SkeletonLoader;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import ApiTabs from "@theme/ApiTabs";
|
|
11
|
+
import Details from "@theme/Details";
|
|
12
|
+
import Markdown from "@theme/Markdown";
|
|
13
|
+
import ResponseHeaders from "@theme/ResponseHeaders";
|
|
14
|
+
import ResponseSchema from "@theme/ResponseSchema";
|
|
15
|
+
import TabItem from "@theme/TabItem";
|
|
16
|
+
import { ApiItem } from "docusaurus-plugin-openapi-docs/lib/types";
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
id?: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
responses: ApiItem["responses"];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const StatusCodes: React.FC<Props> = ({ label, id, responses }: any) => {
|
|
25
|
+
if (!responses) return null;
|
|
26
|
+
|
|
27
|
+
const codes = Object.keys(responses);
|
|
28
|
+
if (codes.length === 0) return null;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ApiTabs label={label} id={id}>
|
|
32
|
+
{codes.map((code) => {
|
|
33
|
+
const response = responses[code];
|
|
34
|
+
const responseHeaders = response.headers;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
<TabItem key={code} label={code} value={code}>
|
|
39
|
+
<div>
|
|
40
|
+
{response.description && (
|
|
41
|
+
<div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>
|
|
42
|
+
<Markdown>{response.description}</Markdown>
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
{responseHeaders && (
|
|
47
|
+
<Details
|
|
48
|
+
className="openapi-markdown__details"
|
|
49
|
+
data-collapsed={true}
|
|
50
|
+
open={false}
|
|
51
|
+
style={{ textAlign: "left", marginBottom: "1rem" }}
|
|
52
|
+
summary={
|
|
53
|
+
<summary>
|
|
54
|
+
<strong>Response Headers</strong>
|
|
55
|
+
</summary>
|
|
56
|
+
}
|
|
57
|
+
>
|
|
58
|
+
<ResponseHeaders responseHeaders={responseHeaders} />
|
|
59
|
+
</Details>
|
|
60
|
+
)}
|
|
61
|
+
<ResponseSchema
|
|
62
|
+
title="Schema"
|
|
63
|
+
body={{ content: response.content }}
|
|
64
|
+
/>
|
|
65
|
+
</TabItem>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
</ApiTabs>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default StatusCodes;
|