docusaurus-theme-openapi-docs 0.0.0-1012 → 0.0.0-1013
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/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/lib/theme/CodeSamples/index.d.ts +8 -0
- package/lib/theme/{ResponseSamples → CodeSamples}/index.js +4 -4
- package/lib/theme/ResponseExamples/index.js +9 -9
- package/lib/theme/styles.scss +1 -1
- package/package.json +3 -3
- package/src/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/src/theme/{ResponseSamples → CodeSamples}/index.tsx +5 -10
- package/src/theme/ResponseExamples/index.tsx +6 -9
- package/src/theme/styles.scss +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/theme/ResponseSamples/_ResponseSamples.scss +0 -3
- package/lib/theme/ResponseSamples/index.d.ts +0 -8
- package/src/theme/ResponseSamples/_ResponseSamples.scss +0 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Language } from "prism-react-renderer";
|
|
3
|
+
export interface Props {
|
|
4
|
+
readonly example: string;
|
|
5
|
+
readonly language: Language;
|
|
6
|
+
}
|
|
7
|
+
declare function CodeSamples({ example, language }: Props): React.JSX.Element;
|
|
8
|
+
export default CodeSamples;
|
|
@@ -13,15 +13,15 @@ var __importDefault =
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
15
|
const CodeBlock_1 = __importDefault(require("@theme/CodeBlock"));
|
|
16
|
-
function
|
|
16
|
+
function CodeSamples({ example, language }) {
|
|
17
17
|
return react_1.default.createElement(
|
|
18
18
|
"div",
|
|
19
|
-
{ className: "openapi-
|
|
19
|
+
{ className: "openapi-code__code-samples-container" },
|
|
20
20
|
react_1.default.createElement(
|
|
21
21
|
CodeBlock_1.default,
|
|
22
22
|
{ language: language ? language : "json" },
|
|
23
|
-
|
|
23
|
+
example
|
|
24
24
|
)
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
-
exports.default =
|
|
27
|
+
exports.default = CodeSamples;
|
|
@@ -17,8 +17,8 @@ exports.ExampleFromSchema =
|
|
|
17
17
|
void 0;
|
|
18
18
|
exports.json2xml = json2xml;
|
|
19
19
|
const react_1 = __importDefault(require("react"));
|
|
20
|
+
const CodeSamples_1 = __importDefault(require("@theme/CodeSamples"));
|
|
20
21
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
21
|
-
const ResponseSamples_1 = __importDefault(require("@theme/ResponseSamples"));
|
|
22
22
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
23
23
|
const createResponseExample_1 = require("docusaurus-plugin-openapi-docs/lib/openapi/createResponseExample");
|
|
24
24
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
@@ -80,8 +80,8 @@ const ResponseExamples = ({ responseExamples, mimeType }) => {
|
|
|
80
80
|
{ className: "openapi-example__summary" },
|
|
81
81
|
exampleValue.summary
|
|
82
82
|
),
|
|
83
|
-
react_1.default.createElement(
|
|
84
|
-
|
|
83
|
+
react_1.default.createElement(CodeSamples_1.default, {
|
|
84
|
+
example: responseExample,
|
|
85
85
|
language: language,
|
|
86
86
|
})
|
|
87
87
|
)
|
|
@@ -114,8 +114,8 @@ const ResponseExample = ({ responseExample, mimeType }) => {
|
|
|
114
114
|
{ className: "openapi-example__summary" },
|
|
115
115
|
responseExample.summary
|
|
116
116
|
),
|
|
117
|
-
react_1.default.createElement(
|
|
118
|
-
|
|
117
|
+
react_1.default.createElement(CodeSamples_1.default, {
|
|
118
|
+
example: exampleContent,
|
|
119
119
|
language: language,
|
|
120
120
|
})
|
|
121
121
|
)
|
|
@@ -164,8 +164,8 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
164
164
|
react_1.default.createElement(
|
|
165
165
|
TabItem_1.default,
|
|
166
166
|
{ label: "Example (auto)", value: "Example (auto)" },
|
|
167
|
-
react_1.default.createElement(
|
|
168
|
-
|
|
167
|
+
react_1.default.createElement(CodeSamples_1.default, {
|
|
168
|
+
example: xmlExample,
|
|
169
169
|
language: "xml",
|
|
170
170
|
})
|
|
171
171
|
)
|
|
@@ -181,8 +181,8 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
181
181
|
react_1.default.createElement(
|
|
182
182
|
TabItem_1.default,
|
|
183
183
|
{ label: "Example (auto)", value: "Example (auto)" },
|
|
184
|
-
react_1.default.createElement(
|
|
185
|
-
|
|
184
|
+
react_1.default.createElement(CodeSamples_1.default, {
|
|
185
|
+
example: JSON.stringify(responseExample, null, 2),
|
|
186
186
|
language: "json",
|
|
187
187
|
})
|
|
188
188
|
)
|
package/lib/theme/styles.scss
CHANGED
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": "0.0.0-
|
|
4
|
+
"version": "0.0.0-1013",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/lodash": "^4.14.176",
|
|
37
37
|
"@types/pako": "^2.0.3",
|
|
38
38
|
"concurrently": "^5.2.0",
|
|
39
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-
|
|
39
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-1013",
|
|
40
40
|
"docusaurus-plugin-sass": "^0.2.3",
|
|
41
41
|
"eslint-plugin-prettier": "^5.0.1"
|
|
42
42
|
},
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=14"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "fbbf74a2c238e78008b551a5671feb0bd35f83b6"
|
|
83
83
|
}
|
|
@@ -11,21 +11,16 @@ import CodeBlock from "@theme/CodeBlock";
|
|
|
11
11
|
import { Language } from "prism-react-renderer";
|
|
12
12
|
|
|
13
13
|
export interface Props {
|
|
14
|
-
readonly
|
|
14
|
+
readonly example: string;
|
|
15
15
|
readonly language: Language;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function
|
|
19
|
-
responseExample,
|
|
20
|
-
language,
|
|
21
|
-
}: Props): React.JSX.Element {
|
|
18
|
+
function CodeSamples({ example, language }: Props): React.JSX.Element {
|
|
22
19
|
return (
|
|
23
|
-
<div className="openapi-
|
|
24
|
-
<CodeBlock language={language ? language : "json"}>
|
|
25
|
-
{responseExample}
|
|
26
|
-
</CodeBlock>
|
|
20
|
+
<div className="openapi-code__code-samples-container">
|
|
21
|
+
<CodeBlock language={language ? language : "json"}>{example}</CodeBlock>
|
|
27
22
|
</div>
|
|
28
23
|
);
|
|
29
24
|
}
|
|
30
25
|
|
|
31
|
-
export default
|
|
26
|
+
export default CodeSamples;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
|
+
import CodeSamples from "@theme/CodeSamples";
|
|
10
11
|
import Markdown from "@theme/Markdown";
|
|
11
|
-
import ResponseSamples from "@theme/ResponseSamples";
|
|
12
12
|
import TabItem from "@theme/TabItem";
|
|
13
13
|
import { sampleResponseFromSchema } from "docusaurus-plugin-openapi-docs/lib/openapi/createResponseExample";
|
|
14
14
|
import format from "xml-formatter";
|
|
@@ -78,10 +78,7 @@ export const ResponseExamples: React.FC<ResponseExamplesProps> = ({
|
|
|
78
78
|
{exampleValue.summary}
|
|
79
79
|
</Markdown>
|
|
80
80
|
)}
|
|
81
|
-
<
|
|
82
|
-
responseExample={responseExample}
|
|
83
|
-
language={language}
|
|
84
|
-
/>
|
|
81
|
+
<CodeSamples example={responseExample} language={language} />
|
|
85
82
|
</TabItem>
|
|
86
83
|
);
|
|
87
84
|
}
|
|
@@ -120,7 +117,7 @@ export const ResponseExample: React.FC<ResponseExampleProps> = ({
|
|
|
120
117
|
{responseExample.summary}
|
|
121
118
|
</Markdown>
|
|
122
119
|
)}
|
|
123
|
-
<
|
|
120
|
+
<CodeSamples example={exampleContent} language={language} />
|
|
124
121
|
</TabItem>
|
|
125
122
|
);
|
|
126
123
|
};
|
|
@@ -167,7 +164,7 @@ export const ExampleFromSchema: React.FC<ExampleFromSchemaProps> = ({
|
|
|
167
164
|
return (
|
|
168
165
|
// @ts-ignore
|
|
169
166
|
<TabItem label="Example (auto)" value="Example (auto)">
|
|
170
|
-
<
|
|
167
|
+
<CodeSamples example={xmlExample} language="xml" />
|
|
171
168
|
</TabItem>
|
|
172
169
|
);
|
|
173
170
|
}
|
|
@@ -180,8 +177,8 @@ export const ExampleFromSchema: React.FC<ExampleFromSchemaProps> = ({
|
|
|
180
177
|
return (
|
|
181
178
|
// @ts-ignore
|
|
182
179
|
<TabItem label="Example (auto)" value="Example (auto)">
|
|
183
|
-
<
|
|
184
|
-
|
|
180
|
+
<CodeSamples
|
|
181
|
+
example={JSON.stringify(responseExample, null, 2)}
|
|
185
182
|
language="json"
|
|
186
183
|
/>
|
|
187
184
|
</TabItem>
|
package/src/theme/styles.scss
CHANGED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/index.ts","./src/plugin-content-docs.d.ts","./src/postman-code-generators.d.ts","./src/react-magic-dropzone.d.ts","./src/theme-classic.d.ts","./src/theme-openapi.d.ts","./src/theme-translations.d.ts","./src/types.ts","./src/markdown/createDescription.ts","./src/markdown/schema.ts","./src/markdown/utils.test.ts","./src/markdown/utils.ts","./src/theme/ApiExplorer/buildPostmanRequest.ts","./src/theme/ApiExplorer/index.tsx","./src/theme/ApiExplorer/persistanceMiddleware.ts","./src/theme/ApiExplorer/postman-collection.d.ts","./src/theme/ApiExplorer/react-modal.d.ts","./src/theme/ApiExplorer/storage-utils.ts","./src/theme/ApiExplorer/Accept/index.tsx","./src/theme/ApiExplorer/Accept/slice.ts","./src/theme/ApiExplorer/ApiCodeBlock/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx","./src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx","./src/theme/ApiExplorer/Authorization/auth-types.ts","./src/theme/ApiExplorer/Authorization/index.tsx","./src/theme/ApiExplorer/Authorization/slice.ts","./src/theme/ApiExplorer/Body/index.tsx","./src/theme/ApiExplorer/Body/slice.ts","./src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts","./src/theme/ApiExplorer/CodeSnippets/index.tsx","./src/theme/ApiExplorer/CodeSnippets/languages.ts","./src/theme/ApiExplorer/CodeTabs/index.tsx","./src/theme/ApiExplorer/ContentType/index.tsx","./src/theme/ApiExplorer/ContentType/slice.ts","./src/theme/ApiExplorer/Export/index.tsx","./src/theme/ApiExplorer/FloatingButton/index.tsx","./src/theme/ApiExplorer/FormFileUpload/index.tsx","./src/theme/ApiExplorer/FormItem/index.tsx","./src/theme/ApiExplorer/FormMultiSelect/index.tsx","./src/theme/ApiExplorer/FormSelect/index.tsx","./src/theme/ApiExplorer/FormTextInput/index.tsx","./src/theme/ApiExplorer/LiveEditor/index.tsx","./src/theme/ApiExplorer/MethodEndpoint/index.tsx","./src/theme/ApiExplorer/ParamOptions/index.tsx","./src/theme/ApiExplorer/ParamOptions/slice.ts","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx","./src/theme/ApiExplorer/Request/index.tsx","./src/theme/ApiExplorer/Request/makeRequest.ts","./src/theme/ApiExplorer/Response/index.tsx","./src/theme/ApiExplorer/Response/slice.ts","./src/theme/ApiExplorer/SecuritySchemes/index.tsx","./src/theme/ApiExplorer/Server/index.tsx","./src/theme/ApiExplorer/Server/slice.ts","./src/theme/ApiItem/hooks.ts","./src/theme/ApiItem/index.tsx","./src/theme/ApiItem/store.ts","./src/theme/ApiItem/Layout/index.tsx","./src/theme/ApiLogo/index.tsx","./src/theme/ApiTabs/index.tsx","./src/theme/ArrayBrackets/index.tsx","./src/theme/
|
|
1
|
+
{"root":["./src/index.ts","./src/plugin-content-docs.d.ts","./src/postman-code-generators.d.ts","./src/react-magic-dropzone.d.ts","./src/theme-classic.d.ts","./src/theme-openapi.d.ts","./src/theme-translations.d.ts","./src/types.ts","./src/markdown/createDescription.ts","./src/markdown/schema.ts","./src/markdown/utils.test.ts","./src/markdown/utils.ts","./src/theme/ApiExplorer/buildPostmanRequest.ts","./src/theme/ApiExplorer/index.tsx","./src/theme/ApiExplorer/persistanceMiddleware.ts","./src/theme/ApiExplorer/postman-collection.d.ts","./src/theme/ApiExplorer/react-modal.d.ts","./src/theme/ApiExplorer/storage-utils.ts","./src/theme/ApiExplorer/Accept/index.tsx","./src/theme/ApiExplorer/Accept/slice.ts","./src/theme/ApiExplorer/ApiCodeBlock/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx","./src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx","./src/theme/ApiExplorer/Authorization/auth-types.ts","./src/theme/ApiExplorer/Authorization/index.tsx","./src/theme/ApiExplorer/Authorization/slice.ts","./src/theme/ApiExplorer/Body/index.tsx","./src/theme/ApiExplorer/Body/slice.ts","./src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts","./src/theme/ApiExplorer/CodeSnippets/index.tsx","./src/theme/ApiExplorer/CodeSnippets/languages.ts","./src/theme/ApiExplorer/CodeTabs/index.tsx","./src/theme/ApiExplorer/ContentType/index.tsx","./src/theme/ApiExplorer/ContentType/slice.ts","./src/theme/ApiExplorer/Export/index.tsx","./src/theme/ApiExplorer/FloatingButton/index.tsx","./src/theme/ApiExplorer/FormFileUpload/index.tsx","./src/theme/ApiExplorer/FormItem/index.tsx","./src/theme/ApiExplorer/FormMultiSelect/index.tsx","./src/theme/ApiExplorer/FormSelect/index.tsx","./src/theme/ApiExplorer/FormTextInput/index.tsx","./src/theme/ApiExplorer/LiveEditor/index.tsx","./src/theme/ApiExplorer/MethodEndpoint/index.tsx","./src/theme/ApiExplorer/ParamOptions/index.tsx","./src/theme/ApiExplorer/ParamOptions/slice.ts","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx","./src/theme/ApiExplorer/Request/index.tsx","./src/theme/ApiExplorer/Request/makeRequest.ts","./src/theme/ApiExplorer/Response/index.tsx","./src/theme/ApiExplorer/Response/slice.ts","./src/theme/ApiExplorer/SecuritySchemes/index.tsx","./src/theme/ApiExplorer/Server/index.tsx","./src/theme/ApiExplorer/Server/slice.ts","./src/theme/ApiItem/hooks.ts","./src/theme/ApiItem/index.tsx","./src/theme/ApiItem/store.ts","./src/theme/ApiItem/Layout/index.tsx","./src/theme/ApiLogo/index.tsx","./src/theme/ApiTabs/index.tsx","./src/theme/ArrayBrackets/index.tsx","./src/theme/CodeSamples/index.tsx","./src/theme/DiscriminatorTabs/index.tsx","./src/theme/MimeTabs/index.tsx","./src/theme/OperationTabs/index.tsx","./src/theme/ParamsDetails/index.tsx","./src/theme/ParamsItem/index.tsx","./src/theme/RequestSchema/index.tsx","./src/theme/ResponseExamples/index.tsx","./src/theme/ResponseHeaders/index.tsx","./src/theme/ResponseSchema/index.tsx","./src/theme/Schema/index.tsx","./src/theme/SchemaItem/index.tsx","./src/theme/SchemaTabs/index.tsx","./src/theme/SkeletonLoader/index.tsx","./src/theme/StatusCodes/index.tsx"],"version":"5.7.3"}
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|