Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
fix: fix lint problems
Browse files Browse the repository at this point in the history
  • Loading branch information
joolfe committed Jul 24, 2021
1 parent 0c73d11 commit 91ce1a9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"execa"
"execa",
"formdata"
]
}
34 changes: 17 additions & 17 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,25 @@ function parseBody (body = {}, method) {
'text/plain': {}
}
break
case "formdata":
case 'formdata':
content = {
"multipart/form-data": {
schema: {
type: "object",
properties: body.formdata.reduce((acc, v) => {
acc[v.key] = { type: v.type === 'text' ? 'string' : v.type };
if (v.hasOwnProperty("description")) {
acc[v.key].description = v.description == '' ? 'Description' : v.description;
}
if (v.hasOwnProperty("value") && v.value !== '') {
acc[v.key].example = v.value;
};
return acc;
}, {})
}
'multipart/form-data': {
schema: {
type: 'object',
properties: body.formdata.reduce((acc, v) => {
acc[v.key] = { type: v.type === 'text' ? 'string' : v.type }
if (Object.prototype.hasOwnProperty.call(v, 'description')) {
acc[v.key].description = v.description === '' ? 'Description' : v.description
}
if (Object.prototype.hasOwnProperty.call(v, 'value') && v.value !== '') {
acc[v.key].example = v.value
};
return acc
}, {})
}
};
break;
}
}
break
}
return { requestBody: { content } }
}
Expand Down

0 comments on commit 91ce1a9

Please sign in to comment.