@camunda8/docusaurus-theme-openapi-docs 4.5.1
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/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 +154 -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 +7 -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 +201 -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 +394 -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 +11 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +435 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +133 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +283 -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 +178 -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 +49 -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 +11 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.js +80 -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 +176 -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 +230 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +71 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +97 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +72 -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 +233 -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 +443 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.js +223 -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 +207 -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 +519 -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 +213 -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 +511 -0
- package/lib/theme/ApiExplorer/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/index.js +107 -0
- package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +19 -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 +58 -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 +275 -0
- package/lib/theme/ArrayBrackets/index.d.ts +3 -0
- package/lib/theme/ArrayBrackets/index.js +50 -0
- package/lib/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/lib/theme/CodeSamples/index.d.ts +8 -0
- package/lib/theme/CodeSamples/index.js +27 -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 +93 -0
- package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/lib/theme/ParamsItem/index.d.ts +22 -0
- package/lib/theme/ParamsItem/index.js +281 -0
- package/lib/theme/RequestSchema/index.d.ts +15 -0
- package/lib/theme/RequestSchema/index.js +208 -0
- package/lib/theme/ResponseExamples/index.d.ts +18 -0
- package/lib/theme/ResponseExamples/index.js +213 -0
- package/lib/theme/ResponseHeaders/index.d.ts +13 -0
- package/lib/theme/ResponseHeaders/index.js +39 -0
- package/lib/theme/ResponseSchema/index.d.ts +15 -0
- package/lib/theme/ResponseSchema/index.js +165 -0
- package/lib/theme/Schema/index.d.ts +8 -0
- package/lib/theme/Schema/index.js +853 -0
- package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +314 -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 +90 -0
- package/lib/theme/styles.scss +215 -0
- package/lib/theme/translationIds.d.ts +83 -0
- package/lib/theme/translationIds.js +106 -0
- package/lib/types.d.ts +46 -0
- package/lib/types.js +8 -0
- package/package.json +85 -0
- package/src/index.ts +85 -0
- package/src/markdown/createDescription.ts +13 -0
- package/src/markdown/schema.ts +186 -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 +83 -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 +199 -0
- package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
- package/src/theme/ApiExplorer/Body/index.tsx +388 -0
- package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -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 +383 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +139 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +261 -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 +124 -0
- package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
- package/src/theme/ApiExplorer/FormItem/index.tsx +40 -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 +89 -0
- package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +122 -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 +185 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +72 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +94 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +74 -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 +154 -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 +352 -0
- package/src/theme/ApiExplorer/Request/makeRequest.ts +255 -0
- package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
- package/src/theme/ApiExplorer/Response/index.tsx +173 -0
- package/src/theme/ApiExplorer/Response/slice.ts +52 -0
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +375 -0
- package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
- package/src/theme/ApiExplorer/Server/index.tsx +138 -0
- package/src/theme/ApiExplorer/Server/slice.ts +39 -0
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +524 -0
- package/src/theme/ApiExplorer/index.tsx +52 -0
- package/src/theme/ApiExplorer/persistanceMiddleware.ts +73 -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 +243 -0
- package/src/theme/ArrayBrackets/index.tsx +37 -0
- package/src/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/src/theme/CodeSamples/index.tsx +26 -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.d.ts +8 -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 +90 -0
- package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/src/theme/ParamsItem/index.tsx +246 -0
- package/src/theme/RequestSchema/index.tsx +172 -0
- package/src/theme/ResponseExamples/index.tsx +209 -0
- package/src/theme/ResponseHeaders/index.tsx +49 -0
- package/src/theme/ResponseSchema/index.tsx +150 -0
- package/src/theme/Schema/index.tsx +938 -0
- package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/src/theme/SchemaItem/index.tsx +273 -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 +83 -0
- package/src/theme/styles.scss +215 -0
- package/src/theme/translationIds.ts +103 -0
- package/src/theme-classic.d.ts +80 -0
- package/src/theme-openapi.d.ts +20 -0
- package/src/types.ts +72 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,154 @@
|
|
|
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, { useState } from "react";
|
|
9
|
+
|
|
10
|
+
import { translate } from "@docusaurus/Translate";
|
|
11
|
+
import FormItem from "@theme/ApiExplorer/FormItem";
|
|
12
|
+
import ParamArrayFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem";
|
|
13
|
+
import ParamBooleanFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem";
|
|
14
|
+
import ParamMultiSelectFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem";
|
|
15
|
+
import ParamSelectFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem";
|
|
16
|
+
import ParamTextFormItem from "@theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem";
|
|
17
|
+
import { useTypedSelector } from "@theme/ApiItem/hooks";
|
|
18
|
+
import { OPENAPI_PARAM_OPTIONS } from "@theme/translationIds";
|
|
19
|
+
|
|
20
|
+
import { Param } from "./slice";
|
|
21
|
+
|
|
22
|
+
export interface ParamProps {
|
|
23
|
+
param: Param;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ParamOption({ param }: ParamProps) {
|
|
27
|
+
if (param.schema?.type === "array" && param.schema.items?.enum) {
|
|
28
|
+
return <ParamMultiSelectFormItem param={param} />;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (param.schema?.type === "array") {
|
|
32
|
+
return <ParamArrayFormItem param={param} />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (param.schema?.enum) {
|
|
36
|
+
return <ParamSelectFormItem param={param} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (param.schema?.type === "boolean") {
|
|
40
|
+
return <ParamBooleanFormItem param={param} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// integer, number, string, int32, int64, float, double, object, byte, binary,
|
|
44
|
+
// date-time, date, password
|
|
45
|
+
return <ParamTextFormItem param={param} />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function ParamOptionWrapper({ param }: ParamProps) {
|
|
49
|
+
return (
|
|
50
|
+
<FormItem label={param.name} type={param.in} required={param.required}>
|
|
51
|
+
<ParamOption param={param} />
|
|
52
|
+
</FormItem>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function ParamOptions() {
|
|
57
|
+
const [showOptional, setShowOptional] = useState(false);
|
|
58
|
+
|
|
59
|
+
const pathParams = useTypedSelector((state: any) => state.params.path);
|
|
60
|
+
const queryParams = useTypedSelector((state: any) => state.params.query);
|
|
61
|
+
const cookieParams = useTypedSelector((state: any) => state.params.cookie);
|
|
62
|
+
const headerParams = useTypedSelector((state: any) => state.params.header);
|
|
63
|
+
|
|
64
|
+
const allParams = [
|
|
65
|
+
...pathParams,
|
|
66
|
+
...queryParams,
|
|
67
|
+
...cookieParams,
|
|
68
|
+
...headerParams,
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const requiredParams = allParams.filter((p) => p.required);
|
|
72
|
+
const optionalParams = allParams.filter((p) => !p.required);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
{/* Required Parameters */}
|
|
77
|
+
{requiredParams.map((param) => (
|
|
78
|
+
<ParamOptionWrapper key={`${param.in}-${param.name}`} param={param} />
|
|
79
|
+
))}
|
|
80
|
+
|
|
81
|
+
{/* Optional Parameters */}
|
|
82
|
+
{optionalParams.length > 0 && (
|
|
83
|
+
<>
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
className="openapi-explorer__show-more-btn"
|
|
87
|
+
onClick={() => setShowOptional((prev) => !prev)}
|
|
88
|
+
>
|
|
89
|
+
<span
|
|
90
|
+
style={{
|
|
91
|
+
width: "1.5em",
|
|
92
|
+
display: "inline-block",
|
|
93
|
+
textAlign: "center",
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<span
|
|
97
|
+
className={
|
|
98
|
+
showOptional
|
|
99
|
+
? "openapi-explorer__plus-btn--expanded"
|
|
100
|
+
: "openapi-explorer__plus-btn"
|
|
101
|
+
}
|
|
102
|
+
>
|
|
103
|
+
<div>
|
|
104
|
+
<svg
|
|
105
|
+
style={{
|
|
106
|
+
fill: "currentColor",
|
|
107
|
+
width: "10px",
|
|
108
|
+
height: "10px",
|
|
109
|
+
}}
|
|
110
|
+
height="16"
|
|
111
|
+
viewBox="0 0 16 16"
|
|
112
|
+
width="16"
|
|
113
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
+
>
|
|
115
|
+
<path
|
|
116
|
+
d="M9 7h6a1 1 0 0 1 0 2H9v6a1 1 0 0 1-2 0V9H1a1 1 0 1 1 0-2h6V1a1 1 0 1 1 2 0z"
|
|
117
|
+
fillRule="evenodd"
|
|
118
|
+
></path>
|
|
119
|
+
</svg>
|
|
120
|
+
</div>
|
|
121
|
+
</span>
|
|
122
|
+
</span>
|
|
123
|
+
{showOptional
|
|
124
|
+
? translate({
|
|
125
|
+
id: OPENAPI_PARAM_OPTIONS.HIDE_OPTIONAL,
|
|
126
|
+
message: "Hide optional parameters",
|
|
127
|
+
})
|
|
128
|
+
: translate({
|
|
129
|
+
id: OPENAPI_PARAM_OPTIONS.SHOW_OPTIONAL,
|
|
130
|
+
message: "Show optional parameters",
|
|
131
|
+
})}
|
|
132
|
+
</button>
|
|
133
|
+
|
|
134
|
+
<div
|
|
135
|
+
className={
|
|
136
|
+
showOptional
|
|
137
|
+
? "openapi-explorer__show-options"
|
|
138
|
+
: "openapi-explorer__hide-options"
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
{optionalParams.map((param) => (
|
|
142
|
+
<ParamOptionWrapper
|
|
143
|
+
key={`${param.in}-${param.name}`}
|
|
144
|
+
param={param}
|
|
145
|
+
/>
|
|
146
|
+
))}
|
|
147
|
+
</div>
|
|
148
|
+
</>
|
|
149
|
+
)}
|
|
150
|
+
</>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default ParamOptions;
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
9
|
+
import { ParameterObject } from "@camunda8/docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
10
|
+
|
|
11
|
+
export type Param = ParameterObject & { value?: string[] | string };
|
|
12
|
+
|
|
13
|
+
export interface State {
|
|
14
|
+
path: Param[];
|
|
15
|
+
query: Param[];
|
|
16
|
+
header: Param[];
|
|
17
|
+
cookie: Param[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const initialState: State = {} as any;
|
|
21
|
+
|
|
22
|
+
export const slice = createSlice({
|
|
23
|
+
name: "params",
|
|
24
|
+
initialState,
|
|
25
|
+
reducers: {
|
|
26
|
+
setParam: (state, action: PayloadAction<Param>) => {
|
|
27
|
+
const newParam = action.payload;
|
|
28
|
+
const paramGroup = state[action.payload.in];
|
|
29
|
+
const index = paramGroup.findIndex((p) => p.name === newParam.name);
|
|
30
|
+
paramGroup[index] = newParam;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const { setParam } = slice.actions;
|
|
36
|
+
|
|
37
|
+
export default slice.reducer;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
.openapi-explorer__request-form {
|
|
2
|
+
background-color: var(--ifm-pre-background);
|
|
3
|
+
border-radius: var(--openapi-card-border-radius);
|
|
4
|
+
border: 1px solid var(--openapi-explorer-border-color);
|
|
5
|
+
box-shadow:
|
|
6
|
+
0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
7
|
+
0 8px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
8
|
+
color: var(--ifm-pre-color);
|
|
9
|
+
line-height: var(--ifm-pre-line-height);
|
|
10
|
+
margin-bottom: var(--ifm-spacing-vertical);
|
|
11
|
+
margin-top: 0;
|
|
12
|
+
overflow: auto;
|
|
13
|
+
transition: 300ms;
|
|
14
|
+
|
|
15
|
+
/* hack for view calculation when monaco is hidden */
|
|
16
|
+
position: relative;
|
|
17
|
+
|
|
18
|
+
&:empty {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
box-shadow:
|
|
24
|
+
0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
25
|
+
0 2px 3px hsla(222, 8%, 43%, 0.15),
|
|
26
|
+
0 16px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.required {
|
|
30
|
+
font-size: var(--ifm-code-font-size);
|
|
31
|
+
color: var(--openapi-required);
|
|
32
|
+
|
|
33
|
+
&.request-body {
|
|
34
|
+
padding-left: 0.25rem;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.openapi-explorer__request-header-container {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
border-bottom: 1px solid var(--openapi-explorer-border-color);
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0.75rem var(--ifm-pre-padding);
|
|
45
|
+
text-transform: uppercase;
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
font-weight: bold;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.openapi-explorer__expand-details-btn {
|
|
51
|
+
&:hover {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.openapi-explorer__details-outer-container {
|
|
57
|
+
padding: 1rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.openapi-explorer__details-container[open] {
|
|
61
|
+
.openapi-explorer__details-summary::before {
|
|
62
|
+
transform: rotate(180deg);
|
|
63
|
+
margin-top: 0.25rem;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.openapi-explorer__details-summary {
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
padding: 0.35rem 0;
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
list-style: none;
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&::-webkit-details-marker {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&::before {
|
|
83
|
+
margin-right: 0.25rem;
|
|
84
|
+
margin-bottom: 0.25rem;
|
|
85
|
+
margin-top: 0.25rem;
|
|
86
|
+
background-image: var(--openapi-explorer-caret-bg);
|
|
87
|
+
border: none !important;
|
|
88
|
+
transform: rotate(90deg);
|
|
89
|
+
content: "";
|
|
90
|
+
height: 1rem;
|
|
91
|
+
width: 1rem;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.openapi-explorer__request-btn {
|
|
96
|
+
border: none;
|
|
97
|
+
border-radius: var(--ifm-global-radius);
|
|
98
|
+
padding: 0.5rem 1rem;
|
|
99
|
+
margin-top: 1rem;
|
|
100
|
+
background-color: var(--ifm-color-primary-light);
|
|
101
|
+
text-transform: uppercase;
|
|
102
|
+
font-weight: bold;
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
color: white;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
transition: 300ms;
|
|
107
|
+
|
|
108
|
+
&:hover {
|
|
109
|
+
background-color: var(--ifm-color-primary-lightest);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:active {
|
|
113
|
+
background-color: var(--ifm-color-primary-light);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.openapi-security__summary-container {
|
|
118
|
+
background: var(--ifm-pre-background);
|
|
119
|
+
border-radius: var(--ifm-pre-border-radius);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Prevent auto zoom on mobile iOS devices when focusing on input elmenents
|
|
123
|
+
@media screen and (-webkit-min-device-pixel-ratio: 0) and (max-device-width: 1024px) {
|
|
124
|
+
.prism-code,
|
|
125
|
+
select,
|
|
126
|
+
input {
|
|
127
|
+
font-size: 1rem;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,352 @@
|
|
|
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
|
+
// @ts-nocheck
|
|
9
|
+
import React, { useState } from "react";
|
|
10
|
+
|
|
11
|
+
import { useDoc } from "@docusaurus/plugin-content-docs/client";
|
|
12
|
+
import { translate } from "@docusaurus/Translate";
|
|
13
|
+
import Accept from "@theme/ApiExplorer/Accept";
|
|
14
|
+
import Authorization from "@theme/ApiExplorer/Authorization";
|
|
15
|
+
import Body from "@theme/ApiExplorer/Body";
|
|
16
|
+
import buildPostmanRequest from "@theme/ApiExplorer/buildPostmanRequest";
|
|
17
|
+
import ContentType from "@theme/ApiExplorer/ContentType";
|
|
18
|
+
import ParamOptions from "@theme/ApiExplorer/ParamOptions";
|
|
19
|
+
import {
|
|
20
|
+
setResponse,
|
|
21
|
+
setCode,
|
|
22
|
+
clearCode,
|
|
23
|
+
setHeaders,
|
|
24
|
+
clearHeaders,
|
|
25
|
+
} from "@theme/ApiExplorer/Response/slice";
|
|
26
|
+
import Server from "@theme/ApiExplorer/Server";
|
|
27
|
+
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
28
|
+
import { OPENAPI_REQUEST } from "@theme/translationIds";
|
|
29
|
+
import { ParameterObject } from "@camunda8/docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
30
|
+
import { ApiItem } from "@camunda8/docusaurus-plugin-openapi-docs/src/types";
|
|
31
|
+
import * as sdk from "postman-collection";
|
|
32
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
33
|
+
|
|
34
|
+
import makeRequest from "./makeRequest";
|
|
35
|
+
|
|
36
|
+
function Request({ item }: { item: ApiItem }) {
|
|
37
|
+
const postman = new sdk.Request(item.postman);
|
|
38
|
+
const metadata = useDoc();
|
|
39
|
+
const { proxy, hide_send_button: hideSendButton } = metadata.frontMatter;
|
|
40
|
+
|
|
41
|
+
const pathParams = useTypedSelector((state: any) => state.params.path);
|
|
42
|
+
const queryParams = useTypedSelector((state: any) => state.params.query);
|
|
43
|
+
const cookieParams = useTypedSelector((state: any) => state.params.cookie);
|
|
44
|
+
const contentType = useTypedSelector((state: any) => state.contentType.value);
|
|
45
|
+
const headerParams = useTypedSelector((state: any) => state.params.header);
|
|
46
|
+
const body = useTypedSelector((state: any) => state.body);
|
|
47
|
+
const accept = useTypedSelector((state: any) => state.accept.value);
|
|
48
|
+
const acceptOptions = useTypedDispatch((state: any) => state.accept.options);
|
|
49
|
+
const authSelected = useTypedSelector((state: any) => state.auth.selected);
|
|
50
|
+
const server = useTypedSelector((state: any) => state.server.value);
|
|
51
|
+
const serverOptions = useTypedSelector((state: any) => state.server.options);
|
|
52
|
+
const auth = useTypedSelector((state: any) => state.auth);
|
|
53
|
+
const dispatch = useTypedDispatch();
|
|
54
|
+
|
|
55
|
+
const [expandAccept, setExpandAccept] = useState(true);
|
|
56
|
+
const [expandAuth, setExpandAuth] = useState(true);
|
|
57
|
+
const [expandBody, setExpandBody] = useState(true);
|
|
58
|
+
const [expandParams, setExpandParams] = useState(true);
|
|
59
|
+
const [expandServer, setExpandServer] = useState(true);
|
|
60
|
+
|
|
61
|
+
const allParams = [
|
|
62
|
+
...pathParams,
|
|
63
|
+
...queryParams,
|
|
64
|
+
...cookieParams,
|
|
65
|
+
...headerParams,
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const postmanRequest = buildPostmanRequest(postman, {
|
|
69
|
+
queryParams,
|
|
70
|
+
pathParams,
|
|
71
|
+
cookieParams,
|
|
72
|
+
contentType,
|
|
73
|
+
accept,
|
|
74
|
+
headerParams,
|
|
75
|
+
body,
|
|
76
|
+
server,
|
|
77
|
+
auth,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const delay = (ms: number) =>
|
|
81
|
+
new Promise((resolve) => setTimeout(resolve, ms));
|
|
82
|
+
|
|
83
|
+
const paramsObject = {
|
|
84
|
+
path: [] as ParameterObject[],
|
|
85
|
+
query: [] as ParameterObject[],
|
|
86
|
+
header: [] as ParameterObject[],
|
|
87
|
+
cookie: [] as ParameterObject[],
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
item.parameters?.forEach(
|
|
91
|
+
(param: { in: "path" | "query" | "header" | "cookie" }) => {
|
|
92
|
+
const paramType = param.in;
|
|
93
|
+
const paramsArray: ParameterObject[] = paramsObject[paramType];
|
|
94
|
+
paramsArray.push(param as ParameterObject);
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const methods = useForm({ shouldFocusError: false });
|
|
99
|
+
|
|
100
|
+
const handleEventStream = async (res) => {
|
|
101
|
+
res.headers && dispatch(setHeaders(Object.fromEntries(res.headers)));
|
|
102
|
+
dispatch(setCode(res.status));
|
|
103
|
+
|
|
104
|
+
const reader = res.body.getReader();
|
|
105
|
+
const decoder = new TextDecoder();
|
|
106
|
+
let result = "";
|
|
107
|
+
while (true) {
|
|
108
|
+
const { done, value } = await reader.read();
|
|
109
|
+
if (done) break;
|
|
110
|
+
result += decoder.decode(value, { stream: true });
|
|
111
|
+
dispatch(setResponse(result));
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const handleResponse = async (res) => {
|
|
116
|
+
dispatch(setResponse(await res.text()));
|
|
117
|
+
dispatch(setCode(res.status));
|
|
118
|
+
res.headers && dispatch(setHeaders(Object.fromEntries(res.headers)));
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const onSubmit = async (data) => {
|
|
122
|
+
dispatch(
|
|
123
|
+
setResponse(
|
|
124
|
+
translate({
|
|
125
|
+
id: OPENAPI_REQUEST.FETCHING_MESSAGE,
|
|
126
|
+
message: "Fetching...",
|
|
127
|
+
})
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
try {
|
|
131
|
+
await delay(1200);
|
|
132
|
+
const res = await makeRequest(postmanRequest, proxy, body);
|
|
133
|
+
if (res.headers.get("content-type")?.includes("text/event-stream")) {
|
|
134
|
+
await handleEventStream(res);
|
|
135
|
+
} else {
|
|
136
|
+
await handleResponse(res);
|
|
137
|
+
}
|
|
138
|
+
} catch (e) {
|
|
139
|
+
console.log(e);
|
|
140
|
+
dispatch(
|
|
141
|
+
setResponse(
|
|
142
|
+
translate({
|
|
143
|
+
id: OPENAPI_REQUEST.CONNECTION_FAILED,
|
|
144
|
+
message: "Connection failed",
|
|
145
|
+
})
|
|
146
|
+
)
|
|
147
|
+
);
|
|
148
|
+
dispatch(clearCode());
|
|
149
|
+
dispatch(clearHeaders());
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const showServerOptions = serverOptions.length > 0;
|
|
154
|
+
const showAcceptOptions = acceptOptions.length > 1;
|
|
155
|
+
const showRequestBody = contentType !== undefined;
|
|
156
|
+
const showRequestButton = item.servers && !hideSendButton;
|
|
157
|
+
const showAuth = authSelected !== undefined;
|
|
158
|
+
const showParams = allParams.length > 0;
|
|
159
|
+
const requestBodyRequired = item.requestBody?.required;
|
|
160
|
+
|
|
161
|
+
if (
|
|
162
|
+
!showAcceptOptions &&
|
|
163
|
+
!showAuth &&
|
|
164
|
+
!showParams &&
|
|
165
|
+
!showRequestBody &&
|
|
166
|
+
!showServerOptions
|
|
167
|
+
) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const expandAllDetails = () => {
|
|
172
|
+
setExpandAccept(true);
|
|
173
|
+
setExpandAuth(true);
|
|
174
|
+
setExpandBody(true);
|
|
175
|
+
setExpandParams(true);
|
|
176
|
+
setExpandServer(true);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const collapseAllDetails = () => {
|
|
180
|
+
setExpandAccept(false);
|
|
181
|
+
setExpandAuth(false);
|
|
182
|
+
setExpandBody(false);
|
|
183
|
+
setExpandParams(false);
|
|
184
|
+
setExpandServer(false);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const allDetailsExpanded =
|
|
188
|
+
expandParams && expandBody && expandServer && expandAuth && expandAccept;
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<FormProvider {...methods}>
|
|
192
|
+
<form
|
|
193
|
+
className="openapi-explorer__request-form"
|
|
194
|
+
onSubmit={methods.handleSubmit(onSubmit)}
|
|
195
|
+
>
|
|
196
|
+
<div className="openapi-explorer__request-header-container">
|
|
197
|
+
<span className="openapi-explorer__request-title">
|
|
198
|
+
{translate({
|
|
199
|
+
id: OPENAPI_REQUEST.REQUEST_TITLE,
|
|
200
|
+
message: "Request",
|
|
201
|
+
})}
|
|
202
|
+
</span>
|
|
203
|
+
{allDetailsExpanded ? (
|
|
204
|
+
<span
|
|
205
|
+
className="openapi-explorer__expand-details-btn"
|
|
206
|
+
onClick={collapseAllDetails}
|
|
207
|
+
>
|
|
208
|
+
{translate({
|
|
209
|
+
id: OPENAPI_REQUEST.COLLAPSE_ALL,
|
|
210
|
+
message: "Collapse all",
|
|
211
|
+
})}
|
|
212
|
+
</span>
|
|
213
|
+
) : (
|
|
214
|
+
<span
|
|
215
|
+
className="openapi-explorer__expand-details-btn"
|
|
216
|
+
onClick={expandAllDetails}
|
|
217
|
+
>
|
|
218
|
+
{translate({
|
|
219
|
+
id: OPENAPI_REQUEST.EXPAND_ALL,
|
|
220
|
+
message: "Expand all",
|
|
221
|
+
})}
|
|
222
|
+
</span>
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
<div className="openapi-explorer__details-outer-container">
|
|
226
|
+
{showServerOptions && item.method !== "event" && (
|
|
227
|
+
<details
|
|
228
|
+
open={expandServer}
|
|
229
|
+
className="openapi-explorer__details-container"
|
|
230
|
+
>
|
|
231
|
+
<summary
|
|
232
|
+
className="openapi-explorer__details-summary"
|
|
233
|
+
onClick={(e) => {
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
setExpandServer(!expandServer);
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
238
|
+
{translate({
|
|
239
|
+
id: OPENAPI_REQUEST.BASE_URL_TITLE,
|
|
240
|
+
message: "Base URL",
|
|
241
|
+
})}
|
|
242
|
+
</summary>
|
|
243
|
+
<Server />
|
|
244
|
+
</details>
|
|
245
|
+
)}
|
|
246
|
+
{showAuth && (
|
|
247
|
+
<details
|
|
248
|
+
open={expandAuth}
|
|
249
|
+
className="openapi-explorer__details-container"
|
|
250
|
+
>
|
|
251
|
+
<summary
|
|
252
|
+
className="openapi-explorer__details-summary"
|
|
253
|
+
onClick={(e) => {
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
setExpandAuth(!expandAuth);
|
|
256
|
+
}}
|
|
257
|
+
>
|
|
258
|
+
{translate({ id: OPENAPI_REQUEST.AUTH_TITLE, message: "Auth" })}
|
|
259
|
+
</summary>
|
|
260
|
+
<Authorization />
|
|
261
|
+
</details>
|
|
262
|
+
)}
|
|
263
|
+
{showParams && (
|
|
264
|
+
<details
|
|
265
|
+
open={
|
|
266
|
+
expandParams || Object.keys(methods.formState.errors).length
|
|
267
|
+
}
|
|
268
|
+
className="openapi-explorer__details-container"
|
|
269
|
+
>
|
|
270
|
+
<summary
|
|
271
|
+
className="openapi-explorer__details-summary"
|
|
272
|
+
onClick={(e) => {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
setExpandParams(!expandParams);
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
{translate({
|
|
278
|
+
id: OPENAPI_REQUEST.PARAMETERS_TITLE,
|
|
279
|
+
message: "Parameters",
|
|
280
|
+
})}
|
|
281
|
+
</summary>
|
|
282
|
+
<ParamOptions />
|
|
283
|
+
</details>
|
|
284
|
+
)}
|
|
285
|
+
{showRequestBody && (
|
|
286
|
+
<details
|
|
287
|
+
open={expandBody}
|
|
288
|
+
className="openapi-explorer__details-container"
|
|
289
|
+
>
|
|
290
|
+
<summary
|
|
291
|
+
className="openapi-explorer__details-summary"
|
|
292
|
+
onClick={(e) => {
|
|
293
|
+
e.preventDefault();
|
|
294
|
+
setExpandBody(!expandBody);
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
{translate({ id: OPENAPI_REQUEST.BODY_TITLE, message: "Body" })}
|
|
298
|
+
{requestBodyRequired && (
|
|
299
|
+
<span className="openapi-schema__required">
|
|
300
|
+
|
|
301
|
+
{translate({
|
|
302
|
+
id: OPENAPI_REQUEST.REQUIRED_LABEL,
|
|
303
|
+
message: "required",
|
|
304
|
+
})}
|
|
305
|
+
</span>
|
|
306
|
+
)}
|
|
307
|
+
</summary>
|
|
308
|
+
<>
|
|
309
|
+
<ContentType />
|
|
310
|
+
<Body
|
|
311
|
+
jsonRequestBodyExample={item.jsonRequestBodyExample}
|
|
312
|
+
requestBodyMetadata={item.requestBody}
|
|
313
|
+
required={requestBodyRequired}
|
|
314
|
+
/>
|
|
315
|
+
</>
|
|
316
|
+
</details>
|
|
317
|
+
)}
|
|
318
|
+
{showAcceptOptions && (
|
|
319
|
+
<details
|
|
320
|
+
open={expandAccept}
|
|
321
|
+
className="openapi-explorer__details-container"
|
|
322
|
+
>
|
|
323
|
+
<summary
|
|
324
|
+
className="openapi-explorer__details-summary"
|
|
325
|
+
onClick={(e) => {
|
|
326
|
+
e.preventDefault();
|
|
327
|
+
setExpandAccept(!expandAccept);
|
|
328
|
+
}}
|
|
329
|
+
>
|
|
330
|
+
{translate({
|
|
331
|
+
id: OPENAPI_REQUEST.ACCEPT_TITLE,
|
|
332
|
+
message: "Accept",
|
|
333
|
+
})}
|
|
334
|
+
</summary>
|
|
335
|
+
<Accept />
|
|
336
|
+
</details>
|
|
337
|
+
)}
|
|
338
|
+
{showRequestButton && item.method !== "event" && (
|
|
339
|
+
<button className="openapi-explorer__request-btn" type="submit">
|
|
340
|
+
{translate({
|
|
341
|
+
id: OPENAPI_REQUEST.SEND_BUTTON,
|
|
342
|
+
message: "Send API Request",
|
|
343
|
+
})}
|
|
344
|
+
</button>
|
|
345
|
+
)}
|
|
346
|
+
</div>
|
|
347
|
+
</form>
|
|
348
|
+
</FormProvider>
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export default Request;
|