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

Commit

Permalink
Make example work with more swagger files
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed Aug 8, 2017
1 parent 2f2d972 commit ed5a642
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions example/openapi-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ http.createServer((req, res) => {
res.writeHead(200, cors);
return res.end();
}
bodyParser.json()(req, res, async () => {
console.log(req.body);
bodyParser.json({ limit: '1mb' })(req, res, async () => {
try {
const oas = await converter.convertObj(req.body, {});
res.writeHead(200, Object.assign({ 'content-type': 'application/json' }, cors));
Expand Down
8 changes: 5 additions & 3 deletions packages/api-explorer-ui/lib/create-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ module.exports = (oas, apiSetting) => {
return Object.keys(oas.paths[path]).map((method) => {
const operation = oas.paths[path][method];
let isCategory;
if (!docs.find(category => category.slug === operation.tags[0] && category.type === 'basic')) {

const tag = operation.tags ? operation.tags[0] : path;
if (!docs.find(category => category.slug === tag && category.type === 'basic')) {
docs.push({
_id: Math.random().toString(16),
title: operation.tags[0],
slug: operation.tags[0],
title: tag,
slug: tag,
type: 'basic',
category: { apiSetting },
api: { method },
Expand Down

0 comments on commit ed5a642

Please sign in to comment.