docusaurus-theme-openapi-docs 3.0.0-beta.1 → 3.0.0-beta.10
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/utils.d.ts +3 -2
- package/lib/markdown/utils.js +1 -1
- package/lib/markdown/utils.test.d.ts +1 -0
- package/lib/markdown/utils.test.js +43 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.d.ts +13 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.js +199 -124
- package/lib/theme/ApiExplorer/Accept/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +25 -19
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +27 -16
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +115 -96
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +115 -54
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +41 -30
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +200 -120
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +36 -24
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +35 -28
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +72 -14
- package/lib/theme/ApiExplorer/Authorization/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Body/index.js +8 -1
- package/lib/theme/ApiExplorer/Body/slice.d.ts +3 -3
- 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 +4 -14
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +86 -8
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +3 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +48 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +131 -76
- package/lib/theme/ApiExplorer/ContentType/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Export/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/lib/theme/ApiExplorer/Request/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Request/makeRequest.js +50 -1
- package/lib/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/lib/theme/ApiExplorer/Response/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Response/index.js +19 -19
- package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Server/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +1 -1
- package/lib/theme/ApiExplorer/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/index.js +1 -1
- package/lib/theme/ApiExplorer/storage-utils.d.ts +1 -1
- package/lib/theme/ApiItem/index.js +28 -3
- package/lib/theme/ApiItem/store.d.ts +6 -6
- package/lib/theme/ApiLogo/index.d.ts +2 -2
- package/lib/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/lib/theme/ApiTabs/index.d.ts +7 -0
- package/lib/theme/ApiTabs/index.js +167 -103
- package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
- package/lib/theme/DiscriminatorTabs/index.js +152 -98
- package/lib/theme/Markdown/index.js +37 -0
- package/lib/theme/MimeTabs/index.d.ts +6 -0
- package/lib/theme/MimeTabs/index.js +169 -118
- package/lib/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/lib/theme/OperationTabs/index.d.ts +3 -0
- package/lib/theme/OperationTabs/index.js +234 -0
- package/lib/theme/ParamsItem/index.d.ts +23 -0
- package/lib/theme/ParamsItem/index.js +170 -111
- package/lib/theme/ResponseSamples/index.d.ts +8 -0
- package/lib/theme/ResponseSamples/index.js +18 -13
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +121 -89
- package/lib/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/lib/theme/SchemaTabs/index.d.ts +3 -0
- package/lib/theme/SchemaTabs/index.js +148 -95
- package/lib/theme/styles.scss +5 -0
- package/lib/types.d.ts +4 -4
- package/package.json +8 -7
- package/src/markdown/utils.test.ts +49 -0
- package/src/markdown/utils.ts +5 -3
- package/src/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +21 -8
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/{index.js → index.tsx} +6 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{Element.js → Element.tsx} +5 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{String.js → String.tsx} +4 -4
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/{index.js → index.tsx} +8 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/{index.js → index.tsx} +9 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +12 -2
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/{index.js → index.tsx} +2 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/{index.js → index.tsx} +11 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/{index.js → index.tsx} +10 -5
- package/src/theme/ApiExplorer/Body/index.tsx +3 -1
- package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +55 -0
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +94 -21
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +53 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/src/theme/ApiExplorer/CodeTabs/{index.js → index.tsx} +64 -25
- package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +4 -4
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/src/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/src/theme/ApiExplorer/Request/makeRequest.ts +59 -4
- package/src/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/src/theme/ApiExplorer/Response/index.tsx +2 -2
- package/src/theme/ApiExplorer/index.tsx +1 -1
- package/src/theme/ApiItem/index.tsx +22 -3
- package/src/theme/ApiLogo/index.tsx +1 -1
- package/src/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/src/theme/ApiTabs/{index.js → index.tsx} +75 -31
- package/src/theme/DiscriminatorTabs/{index.js → index.tsx} +63 -28
- package/src/theme/Markdown/index.js +37 -0
- package/src/theme/MimeTabs/{index.js → index.tsx} +64 -30
- package/src/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/src/theme/OperationTabs/index.tsx +218 -0
- package/src/theme/ParamsItem/{index.js → index.tsx} +48 -17
- package/src/theme/ResponseSamples/{index.js → index.tsx} +10 -1
- package/src/theme/SchemaItem/{index.js → index.tsx} +24 -18
- package/src/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/src/theme/SchemaTabs/{index.js → index.tsx} +62 -29
- package/src/theme/styles.scss +5 -0
- package/src/theme-classic.d.ts +69 -2
- package/src/theme-openapi.d.ts +6 -0
- package/tsconfig.json +4 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Map<T> {
|
|
3
|
+
[key: string]: T;
|
|
4
|
+
}
|
|
5
|
+
export interface ExampleObject {
|
|
6
|
+
summary?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
value?: any;
|
|
9
|
+
externalValue?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Props {
|
|
12
|
+
param: {
|
|
13
|
+
description: string;
|
|
14
|
+
example: any;
|
|
15
|
+
examples: Map<ExampleObject>;
|
|
16
|
+
name: string;
|
|
17
|
+
required: boolean;
|
|
18
|
+
deprecated: boolean;
|
|
19
|
+
schema: any;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
declare function ParamsItem({ param: { description, example, examples, name, required, schema, deprecated }, }: Props): React.JSX.Element;
|
|
23
|
+
export default ParamsItem;
|
|
@@ -1,136 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 CodeBlock_1 = __importDefault(require("@theme/CodeBlock"));
|
|
16
|
+
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
17
|
+
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
13
18
|
/* eslint-disable import/no-extraneous-dependencies*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/* eslint-disable import/no-extraneous-dependencies*/
|
|
21
|
-
import {
|
|
22
|
-
guard,
|
|
23
|
-
toString,
|
|
24
|
-
} from "docusaurus-theme-openapi-docs/lib/markdown/utils";
|
|
25
|
-
import ReactMarkdown from "react-markdown";
|
|
26
|
-
import rehypeRaw from "rehype-raw";
|
|
27
|
-
|
|
19
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
20
|
+
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
21
|
+
const rehype_raw_1 = __importDefault(require("rehype-raw"));
|
|
22
|
+
const createDescription_1 = require("../../markdown/createDescription");
|
|
23
|
+
const schema_1 = require("../../markdown/schema");
|
|
24
|
+
const utils_1 = require("../../markdown/utils");
|
|
28
25
|
function ParamsItem({
|
|
29
|
-
param: { description, example, examples, name, required, schema },
|
|
26
|
+
param: { description, example, examples, name, required, schema, deprecated },
|
|
30
27
|
}) {
|
|
31
28
|
if (!schema || !schema?.type) {
|
|
32
29
|
schema = { type: "any" };
|
|
33
30
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
31
|
+
const renderSchemaName = (0, utils_1.guard)(schema, (schema) =>
|
|
32
|
+
react_1.default.createElement(
|
|
33
|
+
"span",
|
|
34
|
+
{ className: "openapi-schema__type" },
|
|
35
|
+
" ",
|
|
36
|
+
(0, schema_1.getSchemaName)(schema)
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
const renderSchemaRequired = (0, utils_1.guard)(required, () =>
|
|
40
|
+
react_1.default.createElement(
|
|
41
|
+
"span",
|
|
42
|
+
{ className: "openapi-schema__required" },
|
|
43
|
+
"required"
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
const renderDeprecated = (0, utils_1.guard)(deprecated, () =>
|
|
47
|
+
react_1.default.createElement(
|
|
48
|
+
"span",
|
|
49
|
+
{ className: "openapi-schema__deprecated" },
|
|
50
|
+
"deprecated"
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
const renderSchema = (0, utils_1.guard)(
|
|
54
|
+
(0, schema_1.getQualifierMessage)(schema),
|
|
55
|
+
(message) =>
|
|
56
|
+
react_1.default.createElement(
|
|
57
|
+
"div",
|
|
58
|
+
null,
|
|
59
|
+
react_1.default.createElement(react_markdown_1.default, {
|
|
60
|
+
children: (0, createDescription_1.createDescription)(message),
|
|
61
|
+
rehypePlugins: [rehype_raw_1.default],
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
const renderDescription = (0, utils_1.guard)(description, (description) =>
|
|
66
|
+
react_1.default.createElement(
|
|
67
|
+
"div",
|
|
68
|
+
null,
|
|
69
|
+
react_1.default.createElement(react_markdown_1.default, {
|
|
70
|
+
children: (0, createDescription_1.createDescription)(description),
|
|
71
|
+
components: {
|
|
57
72
|
pre: "div",
|
|
58
73
|
code({ node, inline, className, children, ...props }) {
|
|
59
74
|
const match = /language-(\w+)/.exec(className || "");
|
|
60
|
-
if (inline)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
if (inline)
|
|
76
|
+
return react_1.default.createElement("code", null, children);
|
|
77
|
+
return !inline && match
|
|
78
|
+
? react_1.default.createElement(
|
|
79
|
+
CodeBlock_1.default,
|
|
80
|
+
{ className: className },
|
|
81
|
+
children
|
|
82
|
+
)
|
|
83
|
+
: react_1.default.createElement(
|
|
84
|
+
CodeBlock_1.default,
|
|
85
|
+
null,
|
|
86
|
+
children
|
|
87
|
+
);
|
|
66
88
|
},
|
|
67
|
-
}
|
|
68
|
-
rehypePlugins
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
const renderDefaultValue = guard(
|
|
89
|
+
},
|
|
90
|
+
rehypePlugins: [rehype_raw_1.default],
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
const renderDefaultValue = (0, utils_1.guard)(
|
|
74
95
|
schema && schema.items
|
|
75
96
|
? schema.items.default
|
|
76
97
|
: schema
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(value) =>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
? schema.default
|
|
99
|
+
: undefined,
|
|
100
|
+
(value) =>
|
|
101
|
+
react_1.default.createElement(
|
|
102
|
+
"div",
|
|
103
|
+
null,
|
|
104
|
+
react_1.default.createElement(react_markdown_1.default, {
|
|
105
|
+
children: `**Default value:** \`${value}\``,
|
|
106
|
+
})
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
const renderExample = (0, utils_1.guard)(
|
|
110
|
+
(0, utils_1.toString)(example),
|
|
111
|
+
(example) =>
|
|
112
|
+
react_1.default.createElement(
|
|
113
|
+
"div",
|
|
114
|
+
null,
|
|
115
|
+
react_1.default.createElement("strong", null, "Example: "),
|
|
116
|
+
example
|
|
117
|
+
)
|
|
84
118
|
);
|
|
85
|
-
|
|
86
|
-
const renderExample = guard(toString(example), (example) => (
|
|
87
|
-
<div>
|
|
88
|
-
<strong>Example: </strong>
|
|
89
|
-
{example}
|
|
90
|
-
</div>
|
|
91
|
-
));
|
|
92
|
-
|
|
93
|
-
const renderExamples = guard(examples, (examples) => {
|
|
119
|
+
const renderExamples = (0, utils_1.guard)(examples, (examples) => {
|
|
94
120
|
const exampleEntries = Object.entries(examples);
|
|
95
|
-
return (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
return react_1.default.createElement(
|
|
122
|
+
react_1.default.Fragment,
|
|
123
|
+
null,
|
|
124
|
+
react_1.default.createElement("strong", null, "Examples:"),
|
|
125
|
+
react_1.default.createElement(
|
|
126
|
+
SchemaTabs_1.default,
|
|
127
|
+
null,
|
|
128
|
+
exampleEntries.map(([exampleName, exampleProperties]) =>
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
react_1.default.createElement(
|
|
131
|
+
TabItem_1.default,
|
|
132
|
+
{ value: exampleName, label: exampleName },
|
|
133
|
+
exampleProperties.summary &&
|
|
134
|
+
react_1.default.createElement(
|
|
135
|
+
"p",
|
|
136
|
+
null,
|
|
137
|
+
exampleProperties.summary
|
|
138
|
+
),
|
|
139
|
+
exampleProperties.description &&
|
|
140
|
+
react_1.default.createElement(
|
|
141
|
+
"p",
|
|
142
|
+
null,
|
|
143
|
+
react_1.default.createElement("strong", null, "Description: "),
|
|
144
|
+
react_1.default.createElement(
|
|
145
|
+
"span",
|
|
146
|
+
null,
|
|
147
|
+
exampleProperties.description
|
|
148
|
+
)
|
|
149
|
+
),
|
|
150
|
+
react_1.default.createElement(
|
|
151
|
+
"p",
|
|
152
|
+
null,
|
|
153
|
+
react_1.default.createElement("strong", null, "Example: "),
|
|
154
|
+
react_1.default.createElement(
|
|
155
|
+
"code",
|
|
156
|
+
null,
|
|
157
|
+
exampleProperties.value
|
|
158
|
+
)
|
|
159
|
+
)
|
|
160
|
+
)
|
|
161
|
+
)
|
|
162
|
+
)
|
|
116
163
|
);
|
|
117
164
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
165
|
+
return react_1.default.createElement(
|
|
166
|
+
"div",
|
|
167
|
+
{ className: "openapi-params__list-item" },
|
|
168
|
+
react_1.default.createElement(
|
|
169
|
+
"span",
|
|
170
|
+
{ className: "openapi-schema__container" },
|
|
171
|
+
react_1.default.createElement(
|
|
172
|
+
"strong",
|
|
173
|
+
{
|
|
174
|
+
className: (0, clsx_1.default)("openapi-schema__property", {
|
|
175
|
+
"openapi-schema__strikethrough": deprecated,
|
|
176
|
+
}),
|
|
177
|
+
},
|
|
178
|
+
name
|
|
179
|
+
),
|
|
180
|
+
renderSchemaName,
|
|
181
|
+
(required || deprecated) &&
|
|
182
|
+
react_1.default.createElement("span", {
|
|
183
|
+
className: "openapi-schema__divider",
|
|
184
|
+
}),
|
|
185
|
+
renderSchemaRequired,
|
|
186
|
+
renderDeprecated
|
|
187
|
+
),
|
|
188
|
+
renderSchema,
|
|
189
|
+
renderDefaultValue,
|
|
190
|
+
renderDescription,
|
|
191
|
+
renderExample,
|
|
192
|
+
renderExamples
|
|
133
193
|
);
|
|
134
194
|
}
|
|
135
|
-
|
|
136
|
-
export default ParamsItem;
|
|
195
|
+
exports.default = ParamsItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Language } from "prism-react-renderer";
|
|
3
|
+
export interface Props {
|
|
4
|
+
readonly responseExample: string;
|
|
5
|
+
readonly language: Language;
|
|
6
|
+
}
|
|
7
|
+
declare function ResponseSamples({ responseExample, language, }: Props): React.JSX.Element;
|
|
8
|
+
export default ResponseSamples;
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 CodeBlock_1 = __importDefault(require("@theme/CodeBlock"));
|
|
12
16
|
function ResponseSamples({ responseExample, language }) {
|
|
13
|
-
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
return react_1.default.createElement(
|
|
18
|
+
"div",
|
|
19
|
+
{ className: "openapi-code__response-samples-container" },
|
|
20
|
+
react_1.default.createElement(
|
|
21
|
+
CodeBlock_1.default,
|
|
22
|
+
{ language: language ? language : "json" },
|
|
23
|
+
responseExample
|
|
24
|
+
)
|
|
19
25
|
);
|
|
20
26
|
}
|
|
21
|
-
|
|
22
|
-
export default ResponseSamples;
|
|
27
|
+
exports.default = ResponseSamples;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
collapsible: boolean;
|
|
5
|
+
name: string;
|
|
6
|
+
qualifierMessage: string | undefined;
|
|
7
|
+
required: boolean;
|
|
8
|
+
schemaName: string;
|
|
9
|
+
schema: any;
|
|
10
|
+
discriminator: boolean;
|
|
11
|
+
}
|
|
12
|
+
export default function SchemaItem({ children: collapsibleSchemaContent, collapsible, name, qualifierMessage, required, schemaName, schema, }: Props): React.JSX.Element;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 CodeBlock_1 = __importDefault(require("@theme/CodeBlock"));
|
|
16
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
17
|
+
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
18
|
+
const rehype_raw_1 = __importDefault(require("rehype-raw"));
|
|
19
|
+
const createDescription_1 = require("../../markdown/createDescription");
|
|
20
|
+
const utils_1 = require("../../markdown/utils");
|
|
19
21
|
function SchemaItem({
|
|
20
22
|
children: collapsibleSchemaContent,
|
|
21
23
|
collapsible,
|
|
@@ -35,89 +37,119 @@ function SchemaItem({
|
|
|
35
37
|
defaultValue = schema.default;
|
|
36
38
|
nullable = schema.nullable;
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
const renderRequired = guard(
|
|
40
|
+
const renderRequired = (0, utils_1.guard)(
|
|
40
41
|
Array.isArray(required) ? required.includes(name) : required,
|
|
41
|
-
() =>
|
|
42
|
+
() =>
|
|
43
|
+
react_1.default.createElement(
|
|
44
|
+
"span",
|
|
45
|
+
{ className: "openapi-schema__required" },
|
|
46
|
+
"required"
|
|
47
|
+
)
|
|
42
48
|
);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
))
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
const renderDeprecated = (0, utils_1.guard)(deprecated, () =>
|
|
50
|
+
react_1.default.createElement(
|
|
51
|
+
"span",
|
|
52
|
+
{ className: "openapi-schema__deprecated" },
|
|
53
|
+
"deprecated"
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
const renderNullable = (0, utils_1.guard)(nullable, () =>
|
|
57
|
+
react_1.default.createElement(
|
|
58
|
+
"span",
|
|
59
|
+
{ className: "openapi-schema__nullable" },
|
|
60
|
+
"nullable"
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
const renderSchemaDescription = (0, utils_1.guard)(
|
|
64
|
+
schemaDescription,
|
|
65
|
+
(description) =>
|
|
66
|
+
react_1.default.createElement(
|
|
67
|
+
"div",
|
|
68
|
+
null,
|
|
69
|
+
react_1.default.createElement(react_markdown_1.default, {
|
|
70
|
+
children: (0, createDescription_1.createDescription)(description),
|
|
71
|
+
components: {
|
|
72
|
+
pre: "div",
|
|
73
|
+
code({ node, inline, className, children, ...props }) {
|
|
74
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
75
|
+
if (inline)
|
|
76
|
+
return react_1.default.createElement("code", null, children);
|
|
77
|
+
return !inline && match
|
|
78
|
+
? react_1.default.createElement(
|
|
79
|
+
CodeBlock_1.default,
|
|
80
|
+
{ className: className },
|
|
81
|
+
children
|
|
82
|
+
)
|
|
83
|
+
: react_1.default.createElement(
|
|
84
|
+
CodeBlock_1.default,
|
|
85
|
+
null,
|
|
86
|
+
children
|
|
87
|
+
);
|
|
88
|
+
},
|
|
66
89
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
rehypePlugins: [rehype_raw_1.default],
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
const renderQualifierMessage = (0, utils_1.guard)(
|
|
95
|
+
qualifierMessage,
|
|
96
|
+
(message) =>
|
|
97
|
+
react_1.default.createElement(
|
|
98
|
+
"div",
|
|
99
|
+
null,
|
|
100
|
+
react_1.default.createElement(react_markdown_1.default, {
|
|
101
|
+
children: (0, createDescription_1.createDescription)(message),
|
|
102
|
+
rehypePlugins: [rehype_raw_1.default],
|
|
103
|
+
})
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
const renderDefaultValue = (0, utils_1.guard)(defaultValue, (value) =>
|
|
107
|
+
react_1.default.createElement(
|
|
108
|
+
"div",
|
|
109
|
+
{ className: "" },
|
|
110
|
+
react_1.default.createElement(react_markdown_1.default, {
|
|
111
|
+
children: `**Default value:** \`${value}\``,
|
|
112
|
+
})
|
|
88
113
|
)
|
|
89
114
|
);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
115
|
+
const schemaContent = react_1.default.createElement(
|
|
116
|
+
"div",
|
|
117
|
+
null,
|
|
118
|
+
react_1.default.createElement(
|
|
119
|
+
"span",
|
|
120
|
+
{ className: "openapi-schema__container" },
|
|
121
|
+
react_1.default.createElement(
|
|
122
|
+
"strong",
|
|
123
|
+
{
|
|
124
|
+
className: (0, clsx_1.default)("openapi-schema__property", {
|
|
96
125
|
"openapi-schema__strikethrough": deprecated,
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
}),
|
|
127
|
+
},
|
|
128
|
+
name
|
|
129
|
+
),
|
|
130
|
+
react_1.default.createElement(
|
|
131
|
+
"span",
|
|
132
|
+
{ className: "openapi-schema__name" },
|
|
133
|
+
" ",
|
|
134
|
+
schemaName
|
|
135
|
+
),
|
|
136
|
+
(nullable || required || deprecated) &&
|
|
137
|
+
react_1.default.createElement("span", {
|
|
138
|
+
className: "openapi-schema__divider",
|
|
139
|
+
}),
|
|
140
|
+
renderNullable,
|
|
141
|
+
renderRequired,
|
|
142
|
+
renderDeprecated
|
|
143
|
+
),
|
|
144
|
+
renderQualifierMessage,
|
|
145
|
+
renderDefaultValue,
|
|
146
|
+
renderSchemaDescription,
|
|
147
|
+
collapsibleSchemaContent ?? collapsibleSchemaContent
|
|
114
148
|
);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</div>
|
|
149
|
+
return react_1.default.createElement(
|
|
150
|
+
"div",
|
|
151
|
+
{ className: "openapi-schema__list-item" },
|
|
152
|
+
collapsible ? collapsibleSchemaContent : schemaContent
|
|
120
153
|
);
|
|
121
154
|
}
|
|
122
|
-
|
|
123
|
-
export default SchemaItem;
|
|
155
|
+
exports.default = SchemaItem;
|