Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit ed5a642

Browse files
author
Dom Harrington
committed
Make example work with more swagger files
1 parent 2f2d972 commit ed5a642

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

example/openapi-converter.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ http.createServer((req, res) => {
1212
res.writeHead(200, cors);
1313
return res.end();
1414
}
15-
bodyParser.json()(req, res, async () => {
16-
console.log(req.body);
15+
bodyParser.json({ limit: '1mb' })(req, res, async () => {
1716
try {
1817
const oas = await converter.convertObj(req.body, {});
1918
res.writeHead(200, Object.assign({ 'content-type': 'application/json' }, cors));

packages/api-explorer-ui/lib/create-docs.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ module.exports = (oas, apiSetting) => {
55
return Object.keys(oas.paths[path]).map((method) => {
66
const operation = oas.paths[path][method];
77
let isCategory;
8-
if (!docs.find(category => category.slug === operation.tags[0] && category.type === 'basic')) {
8+
9+
const tag = operation.tags ? operation.tags[0] : path;
10+
if (!docs.find(category => category.slug === tag && category.type === 'basic')) {
911
docs.push({
1012
_id: Math.random().toString(16),
11-
title: operation.tags[0],
12-
slug: operation.tags[0],
13+
title: tag,
14+
slug: tag,
1315
type: 'basic',
1416
category: { apiSetting },
1517
api: { method },

0 commit comments

Comments
 (0)