docusaurus-plugin-openapi-docs 0.0.0-409 → 0.0.0-410
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/openapi/openapi.js +7 -6
- package/package.json +2 -2
- package/src/openapi/openapi.ts +3 -2
package/lib/openapi/openapi.js
CHANGED
|
@@ -16,7 +16,8 @@ const openapi_to_postmanv2_1 = __importDefault(require("@paloaltonetworks/openap
|
|
|
16
16
|
const postman_collection_1 = __importDefault(require("@paloaltonetworks/postman-collection"));
|
|
17
17
|
const chalk_1 = __importDefault(require("chalk"));
|
|
18
18
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
19
|
-
const
|
|
19
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
20
|
+
const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
|
|
20
21
|
const index_1 = require("../index");
|
|
21
22
|
const createExample_1 = require("./createExample");
|
|
22
23
|
const loadAndResolveSpec_1 = require("./utils/loadAndResolveSpec");
|
|
@@ -41,7 +42,7 @@ function jsonToCollection(data) {
|
|
|
41
42
|
async function createPostmanCollection(openapiData) {
|
|
42
43
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
43
44
|
// Create copy of openapiData
|
|
44
|
-
const data =
|
|
45
|
+
const data = (0, cloneDeep_1.default)(openapiData);
|
|
45
46
|
// Including `servers` breaks postman, so delete all of them.
|
|
46
47
|
delete data.servers;
|
|
47
48
|
for (let pathItemObject of Object.values(data.paths)) {
|
|
@@ -61,7 +62,7 @@ function createItems(openapiData, sidebarOptions) {
|
|
|
61
62
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
62
63
|
// TODO: Find a better way to handle this
|
|
63
64
|
let items = [];
|
|
64
|
-
const infoId = (0,
|
|
65
|
+
const infoId = (0, kebabCase_1.default)(openapiData.info.title);
|
|
65
66
|
if ((sidebarOptions === null || sidebarOptions === void 0 ? void 0 : sidebarOptions.categoryLinkSource) === "tag") {
|
|
66
67
|
// Only create an tag pages if categoryLinkSource set to tag.
|
|
67
68
|
const tags = (_a = openapiData.tags) !== null && _a !== void 0 ? _a : [];
|
|
@@ -72,7 +73,7 @@ function createItems(openapiData, sidebarOptions) {
|
|
|
72
73
|
.map((tag) => {
|
|
73
74
|
var _a;
|
|
74
75
|
const description = getTagDisplayName(tag.name, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []);
|
|
75
|
-
const tagId = (0,
|
|
76
|
+
const tagId = (0, kebabCase_1.default)(tag.name);
|
|
76
77
|
const tagPage = {
|
|
77
78
|
type: "tag",
|
|
78
79
|
id: tagId,
|
|
@@ -114,8 +115,8 @@ function createItems(openapiData, sidebarOptions) {
|
|
|
114
115
|
(_h = (_g = operationObject.summary) !== null && _g !== void 0 ? _g : operationObject.operationId) !== null && _h !== void 0 ? _h : "";
|
|
115
116
|
}
|
|
116
117
|
const baseId = operationObject.operationId
|
|
117
|
-
? (0,
|
|
118
|
-
: (0,
|
|
118
|
+
? (0, kebabCase_1.default)(operationObject.operationId)
|
|
119
|
+
: (0, kebabCase_1.default)(operationObject.summary);
|
|
119
120
|
const servers = (_k = (_j = operationObject.servers) !== null && _j !== void 0 ? _j : pathObject.servers) !== null && _k !== void 0 ? _k : openapiData.servers;
|
|
120
121
|
const security = (_l = operationObject.security) !== null && _l !== void 0 ? _l : openapiData.security;
|
|
121
122
|
// Add security schemes so we know how to handle security.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-410",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=14"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "a988ec527e7daefea40dfafa5b7bed404b7d2e0c"
|
|
71
71
|
}
|
package/src/openapi/openapi.ts
CHANGED
|
@@ -13,7 +13,8 @@ import sdk from "@paloaltonetworks/postman-collection";
|
|
|
13
13
|
import Collection from "@paloaltonetworks/postman-collection";
|
|
14
14
|
import chalk from "chalk";
|
|
15
15
|
import fs from "fs-extra";
|
|
16
|
-
import
|
|
16
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
17
|
+
import kebabCase from "lodash/kebabCase";
|
|
17
18
|
|
|
18
19
|
import { isURL } from "../index";
|
|
19
20
|
import {
|
|
@@ -54,7 +55,7 @@ async function createPostmanCollection(
|
|
|
54
55
|
openapiData: OpenApiObject
|
|
55
56
|
): Promise<Collection> {
|
|
56
57
|
// Create copy of openapiData
|
|
57
|
-
const data =
|
|
58
|
+
const data = cloneDeep(openapiData) as OpenApiObject;
|
|
58
59
|
|
|
59
60
|
// Including `servers` breaks postman, so delete all of them.
|
|
60
61
|
delete data.servers;
|