openapi-explorer 0.9.346 → 0.9.351
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/CHANGELOG.md +1 -0
- package/dist/browser/openapi-explorer.min.js +5 -5
- package/dist/es/openapi-explorer.js +30 -16
- package/dist/es/styles/nav-styles.js +1 -1
- package/dist/es/templates/components-template.js +1 -1
- package/dist/es/templates/endpoint-template.js +1 -4
- package/dist/es/templates/expanded-endpoint-template.js +7 -5
- package/dist/es/templates/focused-endpoint-template.js +3 -9
- package/dist/es/templates/navbar-template.js +3 -2
- package/dist/es/utils/spec-parser.js +17 -14
- package/dist/lib/openapi-explorer.js +30 -16
- package/dist/lib/styles/nav-styles.js +1 -1
- package/dist/lib/templates/components-template.js +1 -1
- package/dist/lib/templates/endpoint-template.js +1 -4
- package/dist/lib/templates/expanded-endpoint-template.js +8 -6
- package/dist/lib/templates/focused-endpoint-template.js +2 -8
- package/dist/lib/templates/navbar-template.js +4 -2
- package/dist/lib/utils/spec-parser.js +18 -14
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@ var _marked = require("marked");
|
|
|
9
9
|
|
|
10
10
|
var _commonUtils = require("./common-utils");
|
|
11
11
|
|
|
12
|
+
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
16
|
async function ProcessSpec(specUrlOrObject, serverUrl = '') {
|
|
@@ -193,6 +195,7 @@ function getComponents(openApiSpec) {
|
|
|
193
195
|
break;
|
|
194
196
|
|
|
195
197
|
case 'securitySchemes':
|
|
198
|
+
case 'securitySchemas':
|
|
196
199
|
break;
|
|
197
200
|
|
|
198
201
|
case 'links':
|
|
@@ -228,14 +231,17 @@ function getComponents(openApiSpec) {
|
|
|
228
231
|
function groupByTags(openApiSpec) {
|
|
229
232
|
const supportedMethods = ['get', 'put', 'post', 'delete', 'patch', 'head', 'options']; // this is also used for ordering endpoints by methods
|
|
230
233
|
|
|
231
|
-
const tags = openApiSpec.tags && Array.isArray(openApiSpec.tags) ? openApiSpec.tags.map(t =>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
const tags = openApiSpec.tags && Array.isArray(openApiSpec.tags) ? openApiSpec.tags.map(t => {
|
|
235
|
+
const name = typeof t === 'string' ? t : t.name;
|
|
236
|
+
return {
|
|
237
|
+
elementId: `tag--${name.replace(_commonUtils.invalidCharsRegEx, '-')}`,
|
|
238
|
+
name: name,
|
|
239
|
+
description: t.description || '',
|
|
240
|
+
headers: t.description ? getHeadersFromMarkdown(t.description) : [],
|
|
241
|
+
paths: [],
|
|
242
|
+
expanded: true
|
|
243
|
+
};
|
|
244
|
+
}) : [];
|
|
239
245
|
const pathsAndWebhooks = openApiSpec.paths || {};
|
|
240
246
|
|
|
241
247
|
if (openApiSpec.webhooks) {
|
|
@@ -248,14 +254,12 @@ function groupByTags(openApiSpec) {
|
|
|
248
254
|
|
|
249
255
|
|
|
250
256
|
for (const pathOrHookName in pathsAndWebhooks) {
|
|
251
|
-
const
|
|
252
|
-
const commonPathProp = {
|
|
253
|
-
servers: pathsAndWebhooks[pathOrHookName].servers || [],
|
|
254
|
-
parameters: pathsAndWebhooks[pathOrHookName].parameters || []
|
|
255
|
-
};
|
|
257
|
+
const commonPathPropServers = pathsAndWebhooks[pathOrHookName].servers || [];
|
|
256
258
|
const isWebhook = pathsAndWebhooks[pathOrHookName]._type === 'webhook'; // eslint-disable-line no-underscore-dangle
|
|
257
259
|
|
|
258
260
|
supportedMethods.forEach(methodName => {
|
|
261
|
+
const commonParams = (0, _lodash.default)(pathsAndWebhooks[pathOrHookName].parameters);
|
|
262
|
+
|
|
259
263
|
if (pathsAndWebhooks[pathOrHookName][methodName]) {
|
|
260
264
|
const pathOrHookObj = openApiSpec.paths[pathOrHookName][methodName]; // If path.methods are tagged, else generate it from path
|
|
261
265
|
|
|
@@ -338,7 +342,7 @@ function groupByTags(openApiSpec) {
|
|
|
338
342
|
path: pathOrHookName,
|
|
339
343
|
operationId: pathOrHookObj.operationId,
|
|
340
344
|
elementId: `${methodName}-${pathOrHookName.replace(_commonUtils.invalidCharsRegEx, '-')}`,
|
|
341
|
-
servers: pathOrHookObj.servers ?
|
|
345
|
+
servers: pathOrHookObj.servers ? commonPathPropServers.concat(pathOrHookObj.servers) : commonPathPropServers,
|
|
342
346
|
parameters: finalParameters,
|
|
343
347
|
requestBody: pathOrHookObj.requestBody,
|
|
344
348
|
responses: pathOrHookObj.responses,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.351",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Rhosys Developers <developers@rhosys.ch>",
|
|
6
6
|
"repository": {
|