docusaurus-theme-openapi-docs 4.5.0 → 4.6.0
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/lib/markdown/schema.js +9 -1
- package/lib/theme/ApiExplorer/Accept/slice.d.ts +5 -2
- package/lib/theme/ApiExplorer/Authorization/index.js +50 -9
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +145 -3
- package/lib/theme/ApiExplorer/Authorization/slice.js +3 -1
- package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.js +126 -0
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +110 -0
- package/lib/theme/ApiExplorer/Body/index.js +94 -100
- package/lib/theme/ApiExplorer/Body/slice.d.ts +1056 -11
- package/lib/theme/ApiExplorer/Body/slice.js +22 -2
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -1
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +37 -26
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +5 -1
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +3 -3
- package/lib/theme/ApiExplorer/CodeTabs/index.js +2 -2
- package/lib/theme/ApiExplorer/ContentType/slice.d.ts +5 -2
- package/lib/theme/ApiExplorer/FormFileUpload/index.js +6 -1
- package/lib/theme/ApiExplorer/FormItem/index.js +6 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +2 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.js +8 -1
- package/lib/theme/ApiExplorer/LiveEditor/index.js +11 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +15 -5
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +11 -3
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +12 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +11 -2
- package/lib/theme/ApiExplorer/ParamOptions/index.js +11 -1
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +0 -4
- package/lib/theme/ApiExplorer/ParamOptions/slice.js +4 -4
- package/lib/theme/ApiExplorer/Request/index.js +110 -17
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +7 -1
- package/lib/theme/ApiExplorer/Request/makeRequest.js +94 -24
- package/lib/theme/ApiExplorer/Response/index.js +34 -14
- package/lib/theme/ApiExplorer/Response/slice.d.ts +31 -7
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +208 -69
- package/lib/theme/ApiExplorer/Server/index.js +16 -2
- package/lib/theme/ApiExplorer/Server/slice.d.ts +49 -3
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +46 -57
- package/lib/theme/ApiExplorer/index.js +11 -1
- package/lib/theme/ApiExplorer/persistenceMiddleware.d.ts +19 -0
- package/lib/theme/ApiExplorer/{persistanceMiddleware.js → persistenceMiddleware.js} +16 -9
- package/lib/theme/ApiExplorer/storage-utils.d.ts +2 -2
- package/lib/theme/ApiExplorer/storage-utils.js +3 -3
- package/lib/theme/ApiItem/Layout/index.d.ts +1 -1
- package/lib/theme/ApiItem/hooks.d.ts +9 -9
- package/lib/theme/ApiItem/index.js +12 -8
- package/lib/theme/ApiItem/store.d.ts +55 -43
- package/lib/theme/ApiTabs/index.js +6 -1
- package/lib/theme/Example/_Example.scss +11 -0
- package/lib/theme/Example/index.d.ts +24 -0
- package/lib/theme/Example/index.js +170 -0
- package/lib/theme/ParamsDetails/index.js +9 -1
- package/lib/theme/ParamsItem/index.d.ts +1 -1
- package/lib/theme/ParamsItem/index.js +43 -74
- package/lib/theme/RequestSchema/index.js +18 -4
- package/lib/theme/ResponseExamples/index.js +23 -3
- package/lib/theme/ResponseSchema/index.js +97 -82
- package/lib/theme/Schema/index.js +106 -23
- package/lib/theme/SchemaItem/index.js +64 -36
- package/lib/theme/SchemaTabs/index.js +4 -1
- package/lib/theme/StatusCodes/index.js +11 -2
- package/lib/theme/styles.scss +5 -0
- package/lib/theme/translationIds.d.ts +90 -0
- package/lib/theme/translationIds.js +114 -0
- package/lib/types.d.ts +9 -1
- package/package.json +28 -28
- package/src/markdown/schema.ts +11 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +51 -10
- package/src/theme/ApiExplorer/Authorization/slice.ts +1 -1
- package/src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx +77 -0
- package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +120 -0
- package/src/theme/ApiExplorer/Body/index.tsx +87 -107
- package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -0
- package/src/theme/ApiExplorer/Body/slice.ts +40 -1
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +43 -29
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +5 -1
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +6 -5
- package/src/theme/ApiExplorer/ContentType/index.tsx +1 -1
- package/src/theme/ApiExplorer/FormFileUpload/index.tsx +6 -1
- package/src/theme/ApiExplorer/FormItem/index.tsx +8 -1
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +10 -1
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +11 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +16 -6
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +12 -4
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +12 -3
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +10 -2
- package/src/theme/ApiExplorer/ParamOptions/slice.ts +1 -1
- package/src/theme/ApiExplorer/Request/index.tsx +108 -17
- package/src/theme/ApiExplorer/Request/makeRequest.ts +106 -25
- package/src/theme/ApiExplorer/Response/index.tsx +30 -8
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +157 -69
- package/src/theme/ApiExplorer/Server/index.tsx +12 -4
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +47 -63
- package/src/theme/ApiExplorer/index.tsx +10 -1
- package/src/theme/ApiExplorer/{persistanceMiddleware.ts → persistenceMiddleware.ts} +23 -13
- package/src/theme/ApiExplorer/storage-utils.ts +4 -4
- package/src/theme/ApiItem/Layout/index.tsx +1 -1
- package/src/theme/ApiItem/index.tsx +12 -7
- package/src/theme/ApiTabs/index.tsx +6 -1
- package/src/theme/Example/_Example.scss +11 -0
- package/src/theme/Example/index.tsx +168 -0
- package/src/theme/Markdown/index.d.ts +8 -0
- package/src/theme/ParamsDetails/index.tsx +10 -1
- package/src/theme/ParamsItem/index.tsx +38 -54
- package/src/theme/RequestSchema/index.tsx +19 -4
- package/src/theme/ResponseExamples/index.tsx +23 -3
- package/src/theme/ResponseSchema/index.tsx +73 -61
- package/src/theme/Schema/index.tsx +128 -33
- package/src/theme/SchemaItem/index.tsx +51 -33
- package/src/theme/SchemaTabs/index.tsx +4 -1
- package/src/theme/StatusCodes/index.tsx +13 -2
- package/src/theme/styles.scss +5 -0
- package/src/theme/translationIds.ts +111 -0
- package/src/theme-openapi.d.ts +7 -275
- package/src/types.ts +9 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +0 -3
|
@@ -12,12 +12,14 @@ var __importDefault =
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
15
16
|
const ApiTabs_1 = __importDefault(require("@theme/ApiTabs"));
|
|
16
17
|
const Details_1 = __importDefault(require("@theme/Details"));
|
|
17
18
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
18
19
|
const ResponseHeaders_1 = __importDefault(require("@theme/ResponseHeaders"));
|
|
19
20
|
const ResponseSchema_1 = __importDefault(require("@theme/ResponseSchema"));
|
|
20
21
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
22
|
+
const translationIds_1 = require("@theme/translationIds");
|
|
21
23
|
const StatusCodes = ({ label, id, responses }) => {
|
|
22
24
|
if (!responses) return null;
|
|
23
25
|
const codes = Object.keys(responses);
|
|
@@ -61,7 +63,11 @@ const StatusCodes = ({ label, id, responses }) => {
|
|
|
61
63
|
react_1.default.createElement(
|
|
62
64
|
"strong",
|
|
63
65
|
null,
|
|
64
|
-
|
|
66
|
+
(0, Translate_1.translate)({
|
|
67
|
+
id: translationIds_1.OPENAPI_STATUS_CODES
|
|
68
|
+
.RESPONSE_HEADERS,
|
|
69
|
+
message: "Response Headers",
|
|
70
|
+
})
|
|
65
71
|
)
|
|
66
72
|
),
|
|
67
73
|
},
|
|
@@ -70,7 +76,10 @@ const StatusCodes = ({ label, id, responses }) => {
|
|
|
70
76
|
})
|
|
71
77
|
),
|
|
72
78
|
react_1.default.createElement(ResponseSchema_1.default, {
|
|
73
|
-
title:
|
|
79
|
+
title: (0, Translate_1.translate)({
|
|
80
|
+
id: translationIds_1.OPENAPI_STATUS_CODES.SCHEMA_TITLE,
|
|
81
|
+
message: "Schema",
|
|
82
|
+
}),
|
|
74
83
|
body: { content: response.content },
|
|
75
84
|
})
|
|
76
85
|
)
|
package/lib/theme/styles.scss
CHANGED
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
@use "./CodeSamples/CodeSamples";
|
|
42
42
|
/* Markdown Styling */
|
|
43
43
|
@use "./Markdown/Details/Details";
|
|
44
|
+
/* Example Styling */
|
|
45
|
+
@use "./Example/Example";
|
|
44
46
|
|
|
45
47
|
:root {
|
|
46
48
|
--openapi-required: var(--ifm-color-danger);
|
|
@@ -67,6 +69,9 @@
|
|
|
67
69
|
--openapi-code-tab-border-color-java: #0374bd;
|
|
68
70
|
--openapi-code-tab-border-color-powershell: #00adef;
|
|
69
71
|
--openapi-code-tab-shadow-color-python: rgba(255, 219, 80, 0.25);
|
|
72
|
+
--openapi-code-tab-shadow-color-curl: var(
|
|
73
|
+
--openapi-code-tab-shadow-color-bash
|
|
74
|
+
);
|
|
70
75
|
--openapi-code-tab-shadow-color-bash: rgba(250, 56, 62, 0.25);
|
|
71
76
|
--openapi-code-tab-shadow-color-go: rgba(84, 199, 236, 0.25);
|
|
72
77
|
--openapi-code-tab-shadow-color-js: rgba(255, 186, 0, 0.25);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export declare const OPENAPI_RESPONSE: {
|
|
2
|
+
TITLE: string;
|
|
3
|
+
CLEAR: string;
|
|
4
|
+
PLACEHOLDER: string;
|
|
5
|
+
HEADERS_TAB: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const OPENAPI_TABS: {
|
|
8
|
+
RESPONSES_LABEL: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const OPENAPI_REQUEST: {
|
|
11
|
+
BODY_TITLE: string;
|
|
12
|
+
ACCEPT_TITLE: string;
|
|
13
|
+
SEND_BUTTON: string;
|
|
14
|
+
REQUIRED_LABEL: string;
|
|
15
|
+
REQUEST_TITLE: string;
|
|
16
|
+
COLLAPSE_ALL: string;
|
|
17
|
+
EXPAND_ALL: string;
|
|
18
|
+
BASE_URL_TITLE: string;
|
|
19
|
+
AUTH_TITLE: string;
|
|
20
|
+
PARAMETERS_TITLE: string;
|
|
21
|
+
FETCHING_MESSAGE: string;
|
|
22
|
+
CONNECTION_FAILED: string;
|
|
23
|
+
ERROR_TIMEOUT: string;
|
|
24
|
+
ERROR_NETWORK: string;
|
|
25
|
+
ERROR_CORS: string;
|
|
26
|
+
ERROR_UNKNOWN: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const OPENAPI_SERVER: {
|
|
29
|
+
EDIT_BUTTON: string;
|
|
30
|
+
HIDE_BUTTON: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const OPENAPI_PARAM_OPTIONS: {
|
|
33
|
+
SHOW_OPTIONAL: string;
|
|
34
|
+
HIDE_OPTIONAL: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const OPENAPI_FORM_FILE_UPLOAD: {
|
|
37
|
+
CLEAR_BUTTON: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const OPENAPI_FORM: {
|
|
40
|
+
FIELD_REQUIRED: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const OPENAPI_AUTH: {
|
|
43
|
+
BEARER_TOKEN: string;
|
|
44
|
+
USERNAME: string;
|
|
45
|
+
PASSWORD: string;
|
|
46
|
+
SECURITY_SCHEME: string;
|
|
47
|
+
};
|
|
48
|
+
export declare const OPENAPI_RESPONSE_EXAMPLES: {
|
|
49
|
+
EXAMPLE: string;
|
|
50
|
+
AUTO_EXAMPLE: string;
|
|
51
|
+
};
|
|
52
|
+
export declare const OPENAPI_BODY: {
|
|
53
|
+
EXAMPLE_FROM_SCHEMA: string;
|
|
54
|
+
};
|
|
55
|
+
export declare const OPENAPI_STATUS_CODES: {
|
|
56
|
+
RESPONSE_HEADERS: string;
|
|
57
|
+
SCHEMA_TITLE: string;
|
|
58
|
+
};
|
|
59
|
+
export declare const OPENAPI_SCHEMA: {
|
|
60
|
+
NO_SCHEMA: string;
|
|
61
|
+
};
|
|
62
|
+
export declare const OPENAPI_SCHEMA_ITEM: {
|
|
63
|
+
REQUIRED: string;
|
|
64
|
+
DEPRECATED: string;
|
|
65
|
+
NULLABLE: string;
|
|
66
|
+
DEFAULT_VALUE: string;
|
|
67
|
+
EXAMPLE: string;
|
|
68
|
+
EXAMPLES: string;
|
|
69
|
+
DESCRIPTION: string;
|
|
70
|
+
CONSTANT_VALUE: string;
|
|
71
|
+
ENUM_VALUE: string;
|
|
72
|
+
ENUM_DESCRIPTION: string;
|
|
73
|
+
POSSIBLE_VALUES: string;
|
|
74
|
+
ONE_OF: string;
|
|
75
|
+
ANY_OF: string;
|
|
76
|
+
};
|
|
77
|
+
export declare const OPENAPI_PARAMS_DETAILS: {
|
|
78
|
+
PARAMETERS_TITLE: string;
|
|
79
|
+
};
|
|
80
|
+
export declare const OPENAPI_SECURITY_SCHEMES: {
|
|
81
|
+
NAME: string;
|
|
82
|
+
TYPE: string;
|
|
83
|
+
SCOPES: string;
|
|
84
|
+
IN: string;
|
|
85
|
+
FLOWS: string;
|
|
86
|
+
DESCRIPTION: string;
|
|
87
|
+
SCHEME: string;
|
|
88
|
+
BEARER_FORMAT: string;
|
|
89
|
+
OPEN_ID_CONNECT_URL: string;
|
|
90
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OPENAPI_SECURITY_SCHEMES =
|
|
10
|
+
exports.OPENAPI_PARAMS_DETAILS =
|
|
11
|
+
exports.OPENAPI_SCHEMA_ITEM =
|
|
12
|
+
exports.OPENAPI_SCHEMA =
|
|
13
|
+
exports.OPENAPI_STATUS_CODES =
|
|
14
|
+
exports.OPENAPI_BODY =
|
|
15
|
+
exports.OPENAPI_RESPONSE_EXAMPLES =
|
|
16
|
+
exports.OPENAPI_AUTH =
|
|
17
|
+
exports.OPENAPI_FORM =
|
|
18
|
+
exports.OPENAPI_FORM_FILE_UPLOAD =
|
|
19
|
+
exports.OPENAPI_PARAM_OPTIONS =
|
|
20
|
+
exports.OPENAPI_SERVER =
|
|
21
|
+
exports.OPENAPI_REQUEST =
|
|
22
|
+
exports.OPENAPI_TABS =
|
|
23
|
+
exports.OPENAPI_RESPONSE =
|
|
24
|
+
void 0;
|
|
25
|
+
exports.OPENAPI_RESPONSE = {
|
|
26
|
+
TITLE: "theme.openapi.response.title",
|
|
27
|
+
CLEAR: "theme.openapi.response.clear",
|
|
28
|
+
PLACEHOLDER: "theme.openapi.response.placeholder",
|
|
29
|
+
HEADERS_TAB: "theme.openapi.response.headersTab",
|
|
30
|
+
};
|
|
31
|
+
exports.OPENAPI_TABS = {
|
|
32
|
+
RESPONSES_LABEL: "theme.openapi.tabs.responses.label",
|
|
33
|
+
};
|
|
34
|
+
exports.OPENAPI_REQUEST = {
|
|
35
|
+
BODY_TITLE: "theme.openapi.request.body.title",
|
|
36
|
+
ACCEPT_TITLE: "theme.openapi.request.accept.title",
|
|
37
|
+
SEND_BUTTON: "theme.openapi.request.sendButton",
|
|
38
|
+
REQUIRED_LABEL: "theme.openapi.request.requiredLabel",
|
|
39
|
+
REQUEST_TITLE: "theme.openapi.request.title",
|
|
40
|
+
COLLAPSE_ALL: "theme.openapi.request.collapseAll",
|
|
41
|
+
EXPAND_ALL: "theme.openapi.request.expandAll",
|
|
42
|
+
BASE_URL_TITLE: "theme.openapi.request.baseUrl.title",
|
|
43
|
+
AUTH_TITLE: "theme.openapi.request.auth.title",
|
|
44
|
+
PARAMETERS_TITLE: "theme.openapi.request.parameters.title",
|
|
45
|
+
FETCHING_MESSAGE: "theme.openapi.request.fetchingMessage",
|
|
46
|
+
CONNECTION_FAILED: "theme.openapi.request.connectionFailed",
|
|
47
|
+
ERROR_TIMEOUT: "theme.openapi.request.error.timeout",
|
|
48
|
+
ERROR_NETWORK: "theme.openapi.request.error.network",
|
|
49
|
+
ERROR_CORS: "theme.openapi.request.error.cors",
|
|
50
|
+
ERROR_UNKNOWN: "theme.openapi.request.error.unknown",
|
|
51
|
+
};
|
|
52
|
+
exports.OPENAPI_SERVER = {
|
|
53
|
+
EDIT_BUTTON: "theme.openapi.server.editButton",
|
|
54
|
+
HIDE_BUTTON: "theme.openapi.server.hideButton",
|
|
55
|
+
};
|
|
56
|
+
exports.OPENAPI_PARAM_OPTIONS = {
|
|
57
|
+
SHOW_OPTIONAL: "theme.openapi.paramOptions.showOptional",
|
|
58
|
+
HIDE_OPTIONAL: "theme.openapi.paramOptions.hideOptional",
|
|
59
|
+
};
|
|
60
|
+
exports.OPENAPI_FORM_FILE_UPLOAD = {
|
|
61
|
+
CLEAR_BUTTON: "theme.openapi.formFileUpload.clearButton",
|
|
62
|
+
};
|
|
63
|
+
exports.OPENAPI_FORM = {
|
|
64
|
+
FIELD_REQUIRED: "theme.openapi.form.fieldRequired",
|
|
65
|
+
};
|
|
66
|
+
exports.OPENAPI_AUTH = {
|
|
67
|
+
BEARER_TOKEN: "theme.openapi.auth.bearerToken",
|
|
68
|
+
USERNAME: "theme.openapi.auth.username",
|
|
69
|
+
PASSWORD: "theme.openapi.auth.password",
|
|
70
|
+
SECURITY_SCHEME: "theme.openapi.auth.securityScheme",
|
|
71
|
+
};
|
|
72
|
+
exports.OPENAPI_RESPONSE_EXAMPLES = {
|
|
73
|
+
EXAMPLE: "theme.openapi.responseExamples.example",
|
|
74
|
+
AUTO_EXAMPLE: "theme.openapi.responseExamples.autoExample",
|
|
75
|
+
};
|
|
76
|
+
exports.OPENAPI_BODY = {
|
|
77
|
+
EXAMPLE_FROM_SCHEMA: "theme.openapi.body.exampleFromSchema",
|
|
78
|
+
};
|
|
79
|
+
exports.OPENAPI_STATUS_CODES = {
|
|
80
|
+
RESPONSE_HEADERS: "theme.openapi.statusCodes.responseHeaders",
|
|
81
|
+
SCHEMA_TITLE: "theme.openapi.statusCodes.schemaTitle",
|
|
82
|
+
};
|
|
83
|
+
exports.OPENAPI_SCHEMA = {
|
|
84
|
+
NO_SCHEMA: "theme.openapi.schema.noSchema",
|
|
85
|
+
};
|
|
86
|
+
exports.OPENAPI_SCHEMA_ITEM = {
|
|
87
|
+
REQUIRED: "theme.openapi.schemaItem.required",
|
|
88
|
+
DEPRECATED: "theme.openapi.schemaItem.deprecated",
|
|
89
|
+
NULLABLE: "theme.openapi.schemaItem.nullable",
|
|
90
|
+
DEFAULT_VALUE: "theme.openapi.schemaItem.defaultValue",
|
|
91
|
+
EXAMPLE: "theme.openapi.schemaItem.example",
|
|
92
|
+
EXAMPLES: "theme.openapi.schemaItem.examples",
|
|
93
|
+
DESCRIPTION: "theme.openapi.schemaItem.description",
|
|
94
|
+
CONSTANT_VALUE: "theme.openapi.schemaItem.constantValue",
|
|
95
|
+
ENUM_VALUE: "theme.openapi.schemaItem.enumValue",
|
|
96
|
+
ENUM_DESCRIPTION: "theme.openapi.schemaItem.enumDescription",
|
|
97
|
+
POSSIBLE_VALUES: "theme.openapi.schemaItem.possibleValues",
|
|
98
|
+
ONE_OF: "theme.openapi.schemaItem.oneOf",
|
|
99
|
+
ANY_OF: "theme.openapi.schemaItem.anyOf",
|
|
100
|
+
};
|
|
101
|
+
exports.OPENAPI_PARAMS_DETAILS = {
|
|
102
|
+
PARAMETERS_TITLE: "theme.openapi.paramsDetails.parametersTitle",
|
|
103
|
+
};
|
|
104
|
+
exports.OPENAPI_SECURITY_SCHEMES = {
|
|
105
|
+
NAME: "theme.openapi.securitySchemes.name",
|
|
106
|
+
TYPE: "theme.openapi.securitySchemes.type",
|
|
107
|
+
SCOPES: "theme.openapi.securitySchemes.scopes",
|
|
108
|
+
IN: "theme.openapi.securitySchemes.in",
|
|
109
|
+
FLOWS: "theme.openapi.securitySchemes.flows",
|
|
110
|
+
DESCRIPTION: "theme.openapi.securitySchemes.description",
|
|
111
|
+
SCHEME: "theme.openapi.securitySchemes.scheme",
|
|
112
|
+
BEARER_FORMAT: "theme.openapi.securitySchemes.bearerFormat",
|
|
113
|
+
OPEN_ID_CONNECT_URL: "theme.openapi.securitySchemes.openIdConnectUrl",
|
|
114
|
+
};
|
package/lib/types.d.ts
CHANGED
|
@@ -3,7 +3,15 @@ import type { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
|
|
|
3
3
|
export interface ThemeConfig {
|
|
4
4
|
api?: {
|
|
5
5
|
proxy?: string;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Controls how authentication credentials are persisted in the API explorer.
|
|
8
|
+
* - `false`: No persistence (in-memory only)
|
|
9
|
+
* - `"sessionStorage"`: Persist for the browser session (default)
|
|
10
|
+
* - `"localStorage"`: Persist across browser sessions
|
|
11
|
+
*/
|
|
12
|
+
authPersistence?: false | "sessionStorage" | "localStorage";
|
|
13
|
+
/** Request timeout in milliseconds. Defaults to 30000 (30 seconds). */
|
|
14
|
+
requestTimeout?: number;
|
|
7
15
|
};
|
|
8
16
|
}
|
|
9
17
|
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.6.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -31,45 +31,45 @@
|
|
|
31
31
|
"@docusaurus/theme-classic": "^3.5.0",
|
|
32
32
|
"@docusaurus/theme-common": "^3.5.0",
|
|
33
33
|
"@docusaurus/types": "^3.5.0",
|
|
34
|
-
"@types/crypto-js": "^4.
|
|
35
|
-
"@types/file-saver": "^2.0.
|
|
36
|
-
"@types/lodash": "^4.
|
|
34
|
+
"@types/crypto-js": "^4.2.2",
|
|
35
|
+
"@types/file-saver": "^2.0.7",
|
|
36
|
+
"@types/lodash": "^4.17.20",
|
|
37
37
|
"@types/pako": "^2.0.3",
|
|
38
38
|
"@types/postman-collection": "^3.5.11",
|
|
39
39
|
"@types/react-modal": "^3.16.3",
|
|
40
|
-
"concurrently": "^
|
|
41
|
-
"docusaurus-plugin-openapi-docs": "^4.
|
|
42
|
-
"docusaurus-plugin-sass": "^0.2.
|
|
43
|
-
"eslint-plugin-prettier": "^5.
|
|
40
|
+
"concurrently": "^9.2.0",
|
|
41
|
+
"docusaurus-plugin-openapi-docs": "^4.6.0",
|
|
42
|
+
"docusaurus-plugin-sass": "^0.2.6",
|
|
43
|
+
"eslint-plugin-prettier": "^5.5.1"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@hookform/error-message": "^2.0.1",
|
|
47
|
-
"@reduxjs/toolkit": "^
|
|
47
|
+
"@reduxjs/toolkit": "^2.8.2",
|
|
48
48
|
"allof-merge": "^0.6.6",
|
|
49
49
|
"buffer": "^6.0.3",
|
|
50
|
-
"clsx": "^
|
|
51
|
-
"copy-text-to-clipboard": "^3.
|
|
52
|
-
"crypto-js": "^4.
|
|
50
|
+
"clsx": "^2.1.1",
|
|
51
|
+
"copy-text-to-clipboard": "^3.2.0",
|
|
52
|
+
"crypto-js": "^4.2.0",
|
|
53
53
|
"file-saver": "^2.0.5",
|
|
54
|
-
"lodash": "^4.17.
|
|
54
|
+
"lodash": "^4.17.21",
|
|
55
55
|
"pako": "^2.1.0",
|
|
56
|
-
"postman-code-generators": "^
|
|
57
|
-
"postman-collection": "^
|
|
58
|
-
"prism-react-renderer": "^2.
|
|
56
|
+
"postman-code-generators": "^2.0.0",
|
|
57
|
+
"postman-collection": "^5.0.2",
|
|
58
|
+
"prism-react-renderer": "^2.4.1",
|
|
59
59
|
"process": "^0.11.10",
|
|
60
|
-
"react-hook-form": "^7.
|
|
61
|
-
"react-live": "^4.
|
|
60
|
+
"react-hook-form": "^7.59.0",
|
|
61
|
+
"react-live": "^4.1.8",
|
|
62
62
|
"react-magic-dropzone": "^1.0.1",
|
|
63
|
-
"react-markdown": "^
|
|
64
|
-
"react-modal": "^3.
|
|
65
|
-
"react-redux": "^
|
|
66
|
-
"rehype-raw": "^
|
|
67
|
-
"remark-gfm": "
|
|
68
|
-
"sass": "^1.
|
|
69
|
-
"sass-loader": "^16.0.
|
|
63
|
+
"react-markdown": "^10.1.0",
|
|
64
|
+
"react-modal": "^3.16.3",
|
|
65
|
+
"react-redux": "^9.2.0",
|
|
66
|
+
"rehype-raw": "^7.0.0",
|
|
67
|
+
"remark-gfm": "4.0.1",
|
|
68
|
+
"sass": "^1.89.2",
|
|
69
|
+
"sass-loader": "^16.0.5",
|
|
70
70
|
"unist-util-visit": "^5.0.0",
|
|
71
|
-
"url": "^0.11.
|
|
72
|
-
"xml-formatter": "^
|
|
71
|
+
"url": "^0.11.4",
|
|
72
|
+
"xml-formatter": "^3.6.6"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@docusaurus/theme-common": "^3.5.0",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": ">=14"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "c7c5ca9934031d166faa0740746ef1a39e72982d"
|
|
85
85
|
}
|
package/src/markdown/schema.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
+
import { translate } from "@docusaurus/Translate";
|
|
9
|
+
|
|
10
|
+
import { OPENAPI_SCHEMA_ITEM } from "../theme/translationIds";
|
|
8
11
|
import { SchemaObject } from "../types";
|
|
9
12
|
|
|
10
13
|
function prettyName(schema: SchemaObject, circular?: boolean) {
|
|
@@ -40,6 +43,10 @@ function prettyName(schema: SchemaObject, circular?: boolean) {
|
|
|
40
43
|
// return schema.type;
|
|
41
44
|
}
|
|
42
45
|
|
|
46
|
+
if (Array.isArray(schema.type)) {
|
|
47
|
+
return schema.type.join(" | ");
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
return schema.title ?? schema.type;
|
|
44
51
|
}
|
|
45
52
|
|
|
@@ -72,7 +79,10 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
|
|
|
72
79
|
return getQualifierMessage(schema.items);
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
let message =
|
|
82
|
+
let message = `**${translate({
|
|
83
|
+
id: OPENAPI_SCHEMA_ITEM.POSSIBLE_VALUES,
|
|
84
|
+
message: "Possible values:",
|
|
85
|
+
})}** `;
|
|
76
86
|
|
|
77
87
|
let qualifierGroups = [];
|
|
78
88
|
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
|
+
import { translate } from "@docusaurus/Translate";
|
|
10
11
|
import FormItem from "@theme/ApiExplorer/FormItem";
|
|
11
12
|
import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
12
13
|
import FormTextInput from "@theme/ApiExplorer/FormTextInput";
|
|
13
14
|
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
15
|
+
import { OPENAPI_AUTH } from "@theme/translationIds";
|
|
14
16
|
|
|
15
17
|
import { setAuthData, setSelectedAuth } from "./slice";
|
|
16
18
|
|
|
@@ -32,11 +34,16 @@ function Authorization() {
|
|
|
32
34
|
return (
|
|
33
35
|
<div>
|
|
34
36
|
{optionKeys.length > 1 && (
|
|
35
|
-
<FormItem
|
|
37
|
+
<FormItem
|
|
38
|
+
label={translate({
|
|
39
|
+
id: OPENAPI_AUTH.SECURITY_SCHEME,
|
|
40
|
+
message: "Security Scheme",
|
|
41
|
+
})}
|
|
42
|
+
>
|
|
36
43
|
<FormSelect
|
|
37
44
|
options={optionKeys}
|
|
38
45
|
value={selected}
|
|
39
|
-
onChange={(e: React.ChangeEvent<
|
|
46
|
+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
40
47
|
dispatch(setSelectedAuth(e.target.value));
|
|
41
48
|
}}
|
|
42
49
|
/>
|
|
@@ -45,9 +52,18 @@ function Authorization() {
|
|
|
45
52
|
{selectedAuth.map((a: any) => {
|
|
46
53
|
if (a.type === "http" && a.scheme === "bearer") {
|
|
47
54
|
return (
|
|
48
|
-
<FormItem
|
|
55
|
+
<FormItem
|
|
56
|
+
label={translate({
|
|
57
|
+
id: OPENAPI_AUTH.BEARER_TOKEN,
|
|
58
|
+
message: "Bearer Token",
|
|
59
|
+
})}
|
|
60
|
+
key={a.key + "-bearer"}
|
|
61
|
+
>
|
|
49
62
|
<FormTextInput
|
|
50
|
-
placeholder=
|
|
63
|
+
placeholder={translate({
|
|
64
|
+
id: OPENAPI_AUTH.BEARER_TOKEN,
|
|
65
|
+
message: "Bearer Token",
|
|
66
|
+
})}
|
|
51
67
|
password
|
|
52
68
|
value={data[a.key].token ?? ""}
|
|
53
69
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -67,9 +83,18 @@ function Authorization() {
|
|
|
67
83
|
|
|
68
84
|
if (a.type === "oauth2") {
|
|
69
85
|
return (
|
|
70
|
-
<FormItem
|
|
86
|
+
<FormItem
|
|
87
|
+
label={translate({
|
|
88
|
+
id: OPENAPI_AUTH.BEARER_TOKEN,
|
|
89
|
+
message: "Bearer Token",
|
|
90
|
+
})}
|
|
91
|
+
key={a.key + "-oauth2"}
|
|
92
|
+
>
|
|
71
93
|
<FormTextInput
|
|
72
|
-
placeholder=
|
|
94
|
+
placeholder={translate({
|
|
95
|
+
id: OPENAPI_AUTH.BEARER_TOKEN,
|
|
96
|
+
message: "Bearer Token",
|
|
97
|
+
})}
|
|
73
98
|
password
|
|
74
99
|
value={data[a.key].token ?? ""}
|
|
75
100
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -90,9 +115,17 @@ function Authorization() {
|
|
|
90
115
|
if (a.type === "http" && a.scheme === "basic") {
|
|
91
116
|
return (
|
|
92
117
|
<React.Fragment key={a.key + "-basic"}>
|
|
93
|
-
<FormItem
|
|
118
|
+
<FormItem
|
|
119
|
+
label={translate({
|
|
120
|
+
id: OPENAPI_AUTH.USERNAME,
|
|
121
|
+
message: "Username",
|
|
122
|
+
})}
|
|
123
|
+
>
|
|
94
124
|
<FormTextInput
|
|
95
|
-
placeholder=
|
|
125
|
+
placeholder={translate({
|
|
126
|
+
id: OPENAPI_AUTH.USERNAME,
|
|
127
|
+
message: "Username",
|
|
128
|
+
})}
|
|
96
129
|
value={data[a.key].username ?? ""}
|
|
97
130
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
98
131
|
const value = e.target.value;
|
|
@@ -106,9 +139,17 @@ function Authorization() {
|
|
|
106
139
|
}}
|
|
107
140
|
/>
|
|
108
141
|
</FormItem>
|
|
109
|
-
<FormItem
|
|
142
|
+
<FormItem
|
|
143
|
+
label={translate({
|
|
144
|
+
id: OPENAPI_AUTH.PASSWORD,
|
|
145
|
+
message: "Password",
|
|
146
|
+
})}
|
|
147
|
+
>
|
|
110
148
|
<FormTextInput
|
|
111
|
-
placeholder=
|
|
149
|
+
placeholder={translate({
|
|
150
|
+
id: OPENAPI_AUTH.PASSWORD,
|
|
151
|
+
message: "Password",
|
|
152
|
+
})}
|
|
112
153
|
password
|
|
113
154
|
value={data[a.key].password ?? ""}
|
|
114
155
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -58,7 +58,7 @@ export function createAuth({
|
|
|
58
58
|
};
|
|
59
59
|
options?: ThemeConfig["api"];
|
|
60
60
|
}): AuthState {
|
|
61
|
-
const storage = createStorage("sessionStorage");
|
|
61
|
+
const storage = createStorage(opts?.authPersistence ?? "sessionStorage");
|
|
62
62
|
|
|
63
63
|
let data: AuthState["data"] = {};
|
|
64
64
|
let options: AuthState["options"] = {};
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
import FormFileUpload from "@theme/ApiExplorer/FormFileUpload";
|
|
10
|
+
import { useTypedDispatch } from "@theme/ApiItem/hooks";
|
|
11
|
+
import { FileContent, setFileArrayFormBody } from "../slice";
|
|
12
|
+
|
|
13
|
+
interface FileArrayFormItemProps {
|
|
14
|
+
id: string;
|
|
15
|
+
description: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function FileArrayFormBodyItem({
|
|
19
|
+
id,
|
|
20
|
+
description,
|
|
21
|
+
}: FileArrayFormItemProps): React.JSX.Element {
|
|
22
|
+
const dispatch = useTypedDispatch();
|
|
23
|
+
const [fileItems, setFileItems] = useState<
|
|
24
|
+
Map<number, FileContent["value"] | undefined>
|
|
25
|
+
>(new Map([[0, undefined]]));
|
|
26
|
+
|
|
27
|
+
const handleFileChange = (index: number, file: any) => {
|
|
28
|
+
const newItems = new Map(fileItems);
|
|
29
|
+
|
|
30
|
+
if (file === undefined) {
|
|
31
|
+
newItems.delete(index);
|
|
32
|
+
|
|
33
|
+
setFileItems(newItems);
|
|
34
|
+
|
|
35
|
+
dispatch(
|
|
36
|
+
setFileArrayFormBody({
|
|
37
|
+
key: id,
|
|
38
|
+
value: [...newItems.values()].filter((item) => item !== undefined),
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let maxIndex = 0;
|
|
45
|
+
|
|
46
|
+
newItems.keys().forEach((item) => {
|
|
47
|
+
maxIndex = item > maxIndex ? item : maxIndex;
|
|
48
|
+
});
|
|
49
|
+
newItems.set(index, {
|
|
50
|
+
src: `/path/to/${file.name}`,
|
|
51
|
+
content: file,
|
|
52
|
+
});
|
|
53
|
+
newItems.set(index + 1, undefined);
|
|
54
|
+
|
|
55
|
+
setFileItems(newItems);
|
|
56
|
+
|
|
57
|
+
dispatch(
|
|
58
|
+
setFileArrayFormBody({
|
|
59
|
+
key: id,
|
|
60
|
+
value: [...newItems.values()].filter((item) => item !== undefined),
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div>
|
|
67
|
+
{[...fileItems.keys()].map((index) => (
|
|
68
|
+
<div key={index}>
|
|
69
|
+
<FormFileUpload
|
|
70
|
+
placeholder={description || id}
|
|
71
|
+
onChange={(file: any) => handleFileChange(index, file)}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|