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,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __importDefault =
|
|
9
|
+
(this && this.__importDefault) ||
|
|
10
|
+
function (mod) {
|
|
11
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const react_1 = __importDefault(require("react"));
|
|
15
|
+
const FormItem_1 = __importDefault(require("@theme/ApiExplorer/FormItem"));
|
|
16
|
+
const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
|
|
17
|
+
const FormTextInput_1 = __importDefault(
|
|
18
|
+
require("@theme/ApiExplorer/FormTextInput")
|
|
19
|
+
);
|
|
20
|
+
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
21
|
+
const slice_1 = require("./slice");
|
|
22
|
+
function Authorization() {
|
|
23
|
+
const data = (0, hooks_1.useTypedSelector)((state) => state.auth.data);
|
|
24
|
+
const options = (0, hooks_1.useTypedSelector)((state) => state.auth.options);
|
|
25
|
+
const selected = (0, hooks_1.useTypedSelector)(
|
|
26
|
+
(state) => state.auth.selected
|
|
27
|
+
);
|
|
28
|
+
const dispatch = (0, hooks_1.useTypedDispatch)();
|
|
29
|
+
if (selected === undefined) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const selectedAuth = options[selected];
|
|
33
|
+
const optionKeys = Object.keys(options);
|
|
34
|
+
return react_1.default.createElement(
|
|
35
|
+
"div",
|
|
36
|
+
null,
|
|
37
|
+
optionKeys.length > 1 &&
|
|
38
|
+
react_1.default.createElement(
|
|
39
|
+
FormItem_1.default,
|
|
40
|
+
{ label: "Security Scheme" },
|
|
41
|
+
react_1.default.createElement(FormSelect_1.default, {
|
|
42
|
+
options: optionKeys,
|
|
43
|
+
value: selected,
|
|
44
|
+
onChange: (e) => {
|
|
45
|
+
dispatch((0, slice_1.setSelectedAuth)(e.target.value));
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
),
|
|
49
|
+
selectedAuth.map((a) => {
|
|
50
|
+
if (a.type === "http" && a.scheme === "bearer") {
|
|
51
|
+
return react_1.default.createElement(
|
|
52
|
+
FormItem_1.default,
|
|
53
|
+
{ label: "Bearer Token", key: a.key + "-bearer" },
|
|
54
|
+
react_1.default.createElement(FormTextInput_1.default, {
|
|
55
|
+
placeholder: "Bearer Token",
|
|
56
|
+
password: true,
|
|
57
|
+
value: data[a.key].token ?? "",
|
|
58
|
+
onChange: (e) => {
|
|
59
|
+
const value = e.target.value;
|
|
60
|
+
dispatch(
|
|
61
|
+
(0, slice_1.setAuthData)({
|
|
62
|
+
scheme: a.key,
|
|
63
|
+
key: "token",
|
|
64
|
+
value: value ? value : undefined,
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (a.type === "oauth2") {
|
|
72
|
+
return react_1.default.createElement(
|
|
73
|
+
FormItem_1.default,
|
|
74
|
+
{ label: "Bearer Token", key: a.key + "-oauth2" },
|
|
75
|
+
react_1.default.createElement(FormTextInput_1.default, {
|
|
76
|
+
placeholder: "Bearer Token",
|
|
77
|
+
password: true,
|
|
78
|
+
value: data[a.key].token ?? "",
|
|
79
|
+
onChange: (e) => {
|
|
80
|
+
const value = e.target.value;
|
|
81
|
+
dispatch(
|
|
82
|
+
(0, slice_1.setAuthData)({
|
|
83
|
+
scheme: a.key,
|
|
84
|
+
key: "token",
|
|
85
|
+
value: value ? value : undefined,
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
if (a.type === "http" && a.scheme === "basic") {
|
|
93
|
+
return react_1.default.createElement(
|
|
94
|
+
react_1.default.Fragment,
|
|
95
|
+
{ key: a.key + "-basic" },
|
|
96
|
+
react_1.default.createElement(
|
|
97
|
+
FormItem_1.default,
|
|
98
|
+
{ label: "Username" },
|
|
99
|
+
react_1.default.createElement(FormTextInput_1.default, {
|
|
100
|
+
placeholder: "Username",
|
|
101
|
+
value: data[a.key].username ?? "",
|
|
102
|
+
onChange: (e) => {
|
|
103
|
+
const value = e.target.value;
|
|
104
|
+
dispatch(
|
|
105
|
+
(0, slice_1.setAuthData)({
|
|
106
|
+
scheme: a.key,
|
|
107
|
+
key: "username",
|
|
108
|
+
value: value ? value : undefined,
|
|
109
|
+
})
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
),
|
|
114
|
+
react_1.default.createElement(
|
|
115
|
+
FormItem_1.default,
|
|
116
|
+
{ label: "Password" },
|
|
117
|
+
react_1.default.createElement(FormTextInput_1.default, {
|
|
118
|
+
placeholder: "Password",
|
|
119
|
+
password: true,
|
|
120
|
+
value: data[a.key].password ?? "",
|
|
121
|
+
onChange: (e) => {
|
|
122
|
+
const value = e.target.value;
|
|
123
|
+
dispatch(
|
|
124
|
+
(0, slice_1.setAuthData)({
|
|
125
|
+
scheme: a.key,
|
|
126
|
+
key: "password",
|
|
127
|
+
value: value ? value : undefined,
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
if (a.type === "apiKey") {
|
|
136
|
+
return react_1.default.createElement(
|
|
137
|
+
FormItem_1.default,
|
|
138
|
+
{ label: `${a.key}`, key: a.key + "-apikey" },
|
|
139
|
+
react_1.default.createElement(FormTextInput_1.default, {
|
|
140
|
+
placeholder: `${a.key}`,
|
|
141
|
+
password: true,
|
|
142
|
+
value: data[a.key].apiKey ?? "",
|
|
143
|
+
onChange: (e) => {
|
|
144
|
+
const value = e.target.value;
|
|
145
|
+
dispatch(
|
|
146
|
+
(0, slice_1.setAuthData)({
|
|
147
|
+
scheme: a.key,
|
|
148
|
+
key: "apiKey",
|
|
149
|
+
value: value ? value : undefined,
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
})
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
exports.default = Authorization;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
import { SecurityRequirementObject, SecuritySchemeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
3
|
+
import { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
|
|
4
|
+
export declare function createAuth({ security, securitySchemes, options: opts, }: {
|
|
5
|
+
security?: SecurityRequirementObject[];
|
|
6
|
+
securitySchemes?: {
|
|
7
|
+
[key: string]: SecuritySchemeObject;
|
|
8
|
+
};
|
|
9
|
+
options?: ThemeConfig["api"];
|
|
10
|
+
}): AuthState;
|
|
11
|
+
export type Scheme = {
|
|
12
|
+
key: string;
|
|
13
|
+
scopes: string[];
|
|
14
|
+
} & SecuritySchemeObject;
|
|
15
|
+
export interface AuthState {
|
|
16
|
+
data: {
|
|
17
|
+
[scheme: string]: {
|
|
18
|
+
[key: string]: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
options: {
|
|
22
|
+
[key: string]: Scheme[];
|
|
23
|
+
};
|
|
24
|
+
selected?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const slice: import("@reduxjs/toolkit").Slice<AuthState, {
|
|
27
|
+
setAuthData: (state: import("immer/dist/internal").WritableDraft<AuthState>, action: PayloadAction<{
|
|
28
|
+
scheme: string;
|
|
29
|
+
key: string;
|
|
30
|
+
value?: string;
|
|
31
|
+
}>) => void;
|
|
32
|
+
setSelectedAuth: (state: import("immer/dist/internal").WritableDraft<AuthState>, action: PayloadAction<string>) => void;
|
|
33
|
+
}, "auth">;
|
|
34
|
+
export declare const setAuthData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
35
|
+
scheme: string;
|
|
36
|
+
key: string;
|
|
37
|
+
value?: string;
|
|
38
|
+
}, "auth/setAuthData">, setSelectedAuth: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "auth/setSelectedAuth">;
|
|
39
|
+
declare const _default: import("redux").Reducer<AuthState>;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var _a;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.setSelectedAuth = exports.setAuthData = exports.slice = void 0;
|
|
11
|
+
exports.createAuth = createAuth;
|
|
12
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
13
|
+
const storage_utils_1 = require("@theme/ApiExplorer/storage-utils");
|
|
14
|
+
const auth_types_1 = require("./auth-types");
|
|
15
|
+
// The global definitions
|
|
16
|
+
// "securitySchemes": {
|
|
17
|
+
// "BearerAuth": { "type": "http", "scheme": "BeAreR" },
|
|
18
|
+
// "BasicAuth": { "type": "http", "scheme": "basic" }
|
|
19
|
+
// },
|
|
20
|
+
// The operation level requirements
|
|
21
|
+
// "security": [
|
|
22
|
+
// { "BearerAuth": [] },
|
|
23
|
+
// { "BearerAuth": [], "BasicAuth": [] }
|
|
24
|
+
// ],
|
|
25
|
+
// SLICE_STATE
|
|
26
|
+
// data:
|
|
27
|
+
// BearerAuth:
|
|
28
|
+
// token=xxx
|
|
29
|
+
// BasicAuth:
|
|
30
|
+
// username=xxx
|
|
31
|
+
// password=xxx
|
|
32
|
+
//
|
|
33
|
+
// options:
|
|
34
|
+
// "BearerAuth": [{ key: "BearerAuth", scopes: [], ...rest }]
|
|
35
|
+
// "BearerAuth and BasicAuth": [{ key: "BearerAuth", scopes: [], ...rest }, { key: "BasicAuth", scopes: [], ...rest }]
|
|
36
|
+
//
|
|
37
|
+
// selected: "BearerAuth and BasicAuth"
|
|
38
|
+
// LOCAL_STORAGE
|
|
39
|
+
// hash(SLICE_STATE.options) -> "BearerAuth and BasicAuth"
|
|
40
|
+
// BearerAuth -> { token: xxx }
|
|
41
|
+
// BasicAuth -> { username: xxx, password: xxx }
|
|
42
|
+
function createAuth({ security, securitySchemes, options: opts }) {
|
|
43
|
+
const storage = (0, storage_utils_1.createStorage)("sessionStorage");
|
|
44
|
+
let data = {};
|
|
45
|
+
let options = {};
|
|
46
|
+
for (const option of security ?? []) {
|
|
47
|
+
const id = Object.keys(option).join(" and ");
|
|
48
|
+
for (const [schemeID, scopes] of Object.entries(option)) {
|
|
49
|
+
const scheme = securitySchemes?.[schemeID];
|
|
50
|
+
if (scheme) {
|
|
51
|
+
if (options[id] === undefined) {
|
|
52
|
+
options[id] = [];
|
|
53
|
+
}
|
|
54
|
+
const dataKeys = (0, auth_types_1.getAuthDataKeys)(scheme);
|
|
55
|
+
for (const key of dataKeys) {
|
|
56
|
+
if (data[schemeID] === undefined) {
|
|
57
|
+
data[schemeID] = {};
|
|
58
|
+
}
|
|
59
|
+
let persisted = undefined;
|
|
60
|
+
try {
|
|
61
|
+
persisted = JSON.parse(storage.getItem(schemeID) ?? "")[key];
|
|
62
|
+
} catch {}
|
|
63
|
+
data[schemeID][key] = persisted;
|
|
64
|
+
}
|
|
65
|
+
options[id].push({
|
|
66
|
+
...scheme,
|
|
67
|
+
key: schemeID,
|
|
68
|
+
scopes,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
let persisted = undefined;
|
|
74
|
+
try {
|
|
75
|
+
persisted =
|
|
76
|
+
storage.getItem((0, storage_utils_1.hashArray)(Object.keys(options))) ??
|
|
77
|
+
undefined;
|
|
78
|
+
} catch {}
|
|
79
|
+
return {
|
|
80
|
+
data,
|
|
81
|
+
options,
|
|
82
|
+
selected: persisted ?? Object.keys(options)[0],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const initialState = {};
|
|
86
|
+
exports.slice = (0, toolkit_1.createSlice)({
|
|
87
|
+
name: "auth",
|
|
88
|
+
initialState,
|
|
89
|
+
reducers: {
|
|
90
|
+
setAuthData: (state, action) => {
|
|
91
|
+
const { scheme, key, value } = action.payload;
|
|
92
|
+
state.data[scheme][key] = value;
|
|
93
|
+
},
|
|
94
|
+
setSelectedAuth: (state, action) => {
|
|
95
|
+
state.selected = action.payload;
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
(_a = exports.slice.actions),
|
|
100
|
+
(exports.setAuthData = _a.setAuthData),
|
|
101
|
+
(exports.setSelectedAuth = _a.setSelectedAuth);
|
|
102
|
+
exports.default = exports.slice.reducer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
3
|
+
export interface Props {
|
|
4
|
+
jsonRequestBodyExample: string;
|
|
5
|
+
requestBodyMetadata?: RequestBodyObject;
|
|
6
|
+
methods?: any;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function BodyWrap({ requestBodyMetadata, jsonRequestBodyExample, methods, required, }: Props): React.JSX.Element | null;
|
|
10
|
+
export default BodyWrap;
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __importDefault =
|
|
9
|
+
(this && this.__importDefault) ||
|
|
10
|
+
function (mod) {
|
|
11
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const react_1 = __importDefault(require("react"));
|
|
15
|
+
const json2xml_1 = __importDefault(require("@theme/ApiExplorer/Body/json2xml"));
|
|
16
|
+
const FormFileUpload_1 = __importDefault(
|
|
17
|
+
require("@theme/ApiExplorer/FormFileUpload")
|
|
18
|
+
);
|
|
19
|
+
const FormItem_1 = __importDefault(require("@theme/ApiExplorer/FormItem"));
|
|
20
|
+
const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
|
|
21
|
+
const FormTextInput_1 = __importDefault(
|
|
22
|
+
require("@theme/ApiExplorer/FormTextInput")
|
|
23
|
+
);
|
|
24
|
+
const LiveEditor_1 = __importDefault(require("@theme/ApiExplorer/LiveEditor"));
|
|
25
|
+
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
26
|
+
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
27
|
+
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
28
|
+
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
29
|
+
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
30
|
+
const slice_1 = require("./slice");
|
|
31
|
+
function BodyWrap({
|
|
32
|
+
requestBodyMetadata,
|
|
33
|
+
jsonRequestBodyExample,
|
|
34
|
+
methods,
|
|
35
|
+
required,
|
|
36
|
+
}) {
|
|
37
|
+
const contentType = (0, hooks_1.useTypedSelector)(
|
|
38
|
+
(state) => state.contentType.value
|
|
39
|
+
);
|
|
40
|
+
// NOTE: We used to check if body was required, but opted to always show the request body
|
|
41
|
+
// to reduce confusion, see: https://github.com/cloud-annotations/docusaurus-openapi/issues/145
|
|
42
|
+
// No body
|
|
43
|
+
if (contentType === undefined) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return react_1.default.createElement(Body, {
|
|
47
|
+
requestBodyMetadata: requestBodyMetadata,
|
|
48
|
+
jsonRequestBodyExample: jsonRequestBodyExample,
|
|
49
|
+
required: required,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function Body({
|
|
53
|
+
requestBodyMetadata,
|
|
54
|
+
jsonRequestBodyExample,
|
|
55
|
+
methods,
|
|
56
|
+
required,
|
|
57
|
+
}) {
|
|
58
|
+
const contentType = (0, hooks_1.useTypedSelector)(
|
|
59
|
+
(state) => state.contentType.value
|
|
60
|
+
);
|
|
61
|
+
const dispatch = (0, hooks_1.useTypedDispatch)();
|
|
62
|
+
// Lot's of possible content-types:
|
|
63
|
+
// - application/json
|
|
64
|
+
// - application/xml
|
|
65
|
+
// - text/plain
|
|
66
|
+
// - text/css
|
|
67
|
+
// - text/html
|
|
68
|
+
// - text/javascript
|
|
69
|
+
// - application/javascript
|
|
70
|
+
// - multipart/form-data
|
|
71
|
+
// - application/x-www-form-urlencoded
|
|
72
|
+
// - image/svg+xml;charset=US-ASCII
|
|
73
|
+
// Show editor:
|
|
74
|
+
// - application/json
|
|
75
|
+
// - application/xml
|
|
76
|
+
// - */*
|
|
77
|
+
// Show form:
|
|
78
|
+
// - multipart/form-data
|
|
79
|
+
// - application/x-www-form-urlencoded
|
|
80
|
+
const schema = requestBodyMetadata?.content?.[contentType]?.schema;
|
|
81
|
+
const example = requestBodyMetadata?.content?.[contentType]?.example;
|
|
82
|
+
const examples = requestBodyMetadata?.content?.[contentType]?.examples;
|
|
83
|
+
if (schema?.format === "binary") {
|
|
84
|
+
return react_1.default.createElement(
|
|
85
|
+
FormItem_1.default,
|
|
86
|
+
null,
|
|
87
|
+
react_1.default.createElement(FormFileUpload_1.default, {
|
|
88
|
+
placeholder: schema.description || "Body",
|
|
89
|
+
onChange: (file) => {
|
|
90
|
+
if (file === undefined) {
|
|
91
|
+
dispatch((0, slice_1.clearRawBody)());
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
dispatch(
|
|
95
|
+
(0, slice_1.setFileRawBody)({
|
|
96
|
+
src: `/path/to/${file.name}`,
|
|
97
|
+
content: file,
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
if (
|
|
105
|
+
(contentType === "multipart/form-data" ||
|
|
106
|
+
contentType === "application/x-www-form-urlencoded") &&
|
|
107
|
+
schema?.type === "object"
|
|
108
|
+
) {
|
|
109
|
+
return react_1.default.createElement(
|
|
110
|
+
FormItem_1.default,
|
|
111
|
+
{ className: "openapi-explorer__form-item-body-container" },
|
|
112
|
+
react_1.default.createElement(
|
|
113
|
+
"div",
|
|
114
|
+
null,
|
|
115
|
+
Object.entries(schema.properties ?? {}).map(([key, val]) => {
|
|
116
|
+
if (val.format === "binary") {
|
|
117
|
+
return react_1.default.createElement(
|
|
118
|
+
FormItem_1.default,
|
|
119
|
+
{
|
|
120
|
+
key: key,
|
|
121
|
+
label: key,
|
|
122
|
+
required:
|
|
123
|
+
Array.isArray(schema.required) &&
|
|
124
|
+
schema.required.includes(key),
|
|
125
|
+
},
|
|
126
|
+
react_1.default.createElement(FormFileUpload_1.default, {
|
|
127
|
+
placeholder: val.description || key,
|
|
128
|
+
onChange: (file) => {
|
|
129
|
+
if (file === undefined) {
|
|
130
|
+
dispatch((0, slice_1.clearFormBodyKey)(key));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
dispatch(
|
|
134
|
+
(0, slice_1.setFileFormBody)({
|
|
135
|
+
key: key,
|
|
136
|
+
value: {
|
|
137
|
+
src: `/path/to/${file.name}`,
|
|
138
|
+
content: file,
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
if (val.enum) {
|
|
147
|
+
return react_1.default.createElement(
|
|
148
|
+
FormItem_1.default,
|
|
149
|
+
{
|
|
150
|
+
key: key,
|
|
151
|
+
label: key,
|
|
152
|
+
required:
|
|
153
|
+
Array.isArray(schema.required) &&
|
|
154
|
+
schema.required.includes(key),
|
|
155
|
+
},
|
|
156
|
+
react_1.default.createElement(FormSelect_1.default, {
|
|
157
|
+
options: ["---", ...val.enum],
|
|
158
|
+
onChange: (e) => {
|
|
159
|
+
const val = e.target.value;
|
|
160
|
+
if (val === "---") {
|
|
161
|
+
dispatch((0, slice_1.clearFormBodyKey)(key));
|
|
162
|
+
} else {
|
|
163
|
+
dispatch(
|
|
164
|
+
(0, slice_1.setStringFormBody)({
|
|
165
|
+
key: key,
|
|
166
|
+
value: val,
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
})
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
// TODO: support all the other types.
|
|
175
|
+
return react_1.default.createElement(
|
|
176
|
+
FormItem_1.default,
|
|
177
|
+
{
|
|
178
|
+
key: key,
|
|
179
|
+
label: key,
|
|
180
|
+
required:
|
|
181
|
+
Array.isArray(schema.required) && schema.required.includes(key),
|
|
182
|
+
},
|
|
183
|
+
react_1.default.createElement(FormTextInput_1.default, {
|
|
184
|
+
paramName: key,
|
|
185
|
+
isRequired:
|
|
186
|
+
Array.isArray(schema.required) && schema.required.includes(key),
|
|
187
|
+
placeholder: val.description || key,
|
|
188
|
+
onChange: (e) => {
|
|
189
|
+
dispatch(
|
|
190
|
+
(0, slice_1.setStringFormBody)({
|
|
191
|
+
key: key,
|
|
192
|
+
value: e.target.value,
|
|
193
|
+
})
|
|
194
|
+
);
|
|
195
|
+
},
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
})
|
|
199
|
+
)
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
let language = "plaintext";
|
|
203
|
+
let defaultBody = ""; //"body content";
|
|
204
|
+
let exampleBody;
|
|
205
|
+
let examplesBodies = [];
|
|
206
|
+
if (
|
|
207
|
+
contentType.includes("application/json") ||
|
|
208
|
+
contentType.endsWith("+json")
|
|
209
|
+
) {
|
|
210
|
+
if (jsonRequestBodyExample) {
|
|
211
|
+
defaultBody = JSON.stringify(jsonRequestBodyExample, null, 2);
|
|
212
|
+
}
|
|
213
|
+
if (example) {
|
|
214
|
+
exampleBody = JSON.stringify(example, null, 2);
|
|
215
|
+
}
|
|
216
|
+
if (examples) {
|
|
217
|
+
for (const [key, example] of Object.entries(examples)) {
|
|
218
|
+
let body = example.value;
|
|
219
|
+
try {
|
|
220
|
+
// If the value is already valid JSON we shouldn't double encode the value
|
|
221
|
+
JSON.parse(example.value);
|
|
222
|
+
} catch (e) {
|
|
223
|
+
body = JSON.stringify(example.value, null, 2);
|
|
224
|
+
}
|
|
225
|
+
examplesBodies.push({
|
|
226
|
+
label: key,
|
|
227
|
+
body,
|
|
228
|
+
summary: example.summary,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
language = "json";
|
|
233
|
+
}
|
|
234
|
+
if (contentType === "application/xml" || contentType.endsWith("+xml")) {
|
|
235
|
+
if (jsonRequestBodyExample) {
|
|
236
|
+
try {
|
|
237
|
+
defaultBody = (0, xml_formatter_1.default)(
|
|
238
|
+
(0, json2xml_1.default)(jsonRequestBodyExample, ""),
|
|
239
|
+
{
|
|
240
|
+
indentation: " ",
|
|
241
|
+
lineSeparator: "\n",
|
|
242
|
+
collapseContent: true,
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
} catch {
|
|
246
|
+
defaultBody = (0, json2xml_1.default)(jsonRequestBodyExample);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (example) {
|
|
250
|
+
try {
|
|
251
|
+
exampleBody = (0, xml_formatter_1.default)(
|
|
252
|
+
(0, json2xml_1.default)(example, ""),
|
|
253
|
+
{
|
|
254
|
+
indentation: " ",
|
|
255
|
+
lineSeparator: "\n",
|
|
256
|
+
collapseContent: true,
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
} catch {
|
|
260
|
+
exampleBody = (0, json2xml_1.default)(example);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (examples) {
|
|
264
|
+
for (const [key, example] of Object.entries(examples)) {
|
|
265
|
+
let formattedXmlBody;
|
|
266
|
+
try {
|
|
267
|
+
formattedXmlBody = (0, xml_formatter_1.default)(example.value, {
|
|
268
|
+
indentation: " ",
|
|
269
|
+
lineSeparator: "\n",
|
|
270
|
+
collapseContent: true,
|
|
271
|
+
});
|
|
272
|
+
} catch {
|
|
273
|
+
formattedXmlBody = example.value;
|
|
274
|
+
}
|
|
275
|
+
examplesBodies.push({
|
|
276
|
+
label: key,
|
|
277
|
+
body: formattedXmlBody,
|
|
278
|
+
summary: example.summary,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
language = "xml";
|
|
283
|
+
}
|
|
284
|
+
if (exampleBody) {
|
|
285
|
+
return react_1.default.createElement(
|
|
286
|
+
FormItem_1.default,
|
|
287
|
+
null,
|
|
288
|
+
react_1.default.createElement(
|
|
289
|
+
SchemaTabs_1.default,
|
|
290
|
+
{ className: "openapi-tabs__schema", lazy: true },
|
|
291
|
+
react_1.default.createElement(
|
|
292
|
+
TabItem_1.default,
|
|
293
|
+
{
|
|
294
|
+
label: "Example (from schema)",
|
|
295
|
+
value: "Example (from schema)",
|
|
296
|
+
default: true,
|
|
297
|
+
},
|
|
298
|
+
react_1.default.createElement(
|
|
299
|
+
LiveEditor_1.default,
|
|
300
|
+
{ action: dispatch, language: language, required: required },
|
|
301
|
+
defaultBody
|
|
302
|
+
)
|
|
303
|
+
),
|
|
304
|
+
react_1.default.createElement(
|
|
305
|
+
TabItem_1.default,
|
|
306
|
+
{ label: "Example", value: "example" },
|
|
307
|
+
example.summary &&
|
|
308
|
+
react_1.default.createElement(
|
|
309
|
+
Markdown_1.default,
|
|
310
|
+
null,
|
|
311
|
+
example.summary
|
|
312
|
+
),
|
|
313
|
+
exampleBody &&
|
|
314
|
+
react_1.default.createElement(
|
|
315
|
+
LiveEditor_1.default,
|
|
316
|
+
{ action: dispatch, language: language, required: required },
|
|
317
|
+
exampleBody
|
|
318
|
+
)
|
|
319
|
+
)
|
|
320
|
+
)
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
if (examplesBodies && examplesBodies.length > 0) {
|
|
324
|
+
return react_1.default.createElement(
|
|
325
|
+
FormItem_1.default,
|
|
326
|
+
{ className: "openapi-explorer__form-item-body-container" },
|
|
327
|
+
react_1.default.createElement(
|
|
328
|
+
SchemaTabs_1.default,
|
|
329
|
+
{ className: "openapi-tabs__schema", lazy: true },
|
|
330
|
+
react_1.default.createElement(
|
|
331
|
+
TabItem_1.default,
|
|
332
|
+
{
|
|
333
|
+
label: "Example (from schema)",
|
|
334
|
+
value: "Example (from schema)",
|
|
335
|
+
default: true,
|
|
336
|
+
},
|
|
337
|
+
react_1.default.createElement(
|
|
338
|
+
LiveEditor_1.default,
|
|
339
|
+
{ action: dispatch, language: language, required: required },
|
|
340
|
+
defaultBody
|
|
341
|
+
)
|
|
342
|
+
),
|
|
343
|
+
examplesBodies.map((example) => {
|
|
344
|
+
return (
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
react_1.default.createElement(
|
|
347
|
+
TabItem_1.default,
|
|
348
|
+
{
|
|
349
|
+
label: example.label,
|
|
350
|
+
value: example.label,
|
|
351
|
+
key: example.label,
|
|
352
|
+
},
|
|
353
|
+
example.summary &&
|
|
354
|
+
react_1.default.createElement(
|
|
355
|
+
Markdown_1.default,
|
|
356
|
+
null,
|
|
357
|
+
example.summary
|
|
358
|
+
),
|
|
359
|
+
example.body &&
|
|
360
|
+
react_1.default.createElement(
|
|
361
|
+
LiveEditor_1.default,
|
|
362
|
+
{ action: dispatch, language: language },
|
|
363
|
+
example.body
|
|
364
|
+
)
|
|
365
|
+
)
|
|
366
|
+
);
|
|
367
|
+
})
|
|
368
|
+
)
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
return react_1.default.createElement(
|
|
372
|
+
FormItem_1.default,
|
|
373
|
+
null,
|
|
374
|
+
react_1.default.createElement(
|
|
375
|
+
LiveEditor_1.default,
|
|
376
|
+
{ action: dispatch, language: language, required: required },
|
|
377
|
+
defaultBody
|
|
378
|
+
)
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
exports.default = BodyWrap;
|