#529: Fixed body to be part of patch, put, post

This commit is contained in:
frikky
2021-10-07 20:50:21 +02:00
parent 0887289149
commit 2da6e43dc6
3 changed files with 25 additions and 7 deletions
+22 -5
View File
@@ -1262,7 +1262,7 @@ const AppCreator = (props) => {
}
}
if (item.body !== undefined && item.body.length > 0) {
if (item.body !== undefined && item.body !== null && item.body.length > 0) {
const required = false
newitem = {
"in": "body",
@@ -1287,21 +1287,38 @@ const AppCreator = (props) => {
},
}
/*
data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem)
} else if (actionBodyRequest.includes(item.method.toUpperCase())) {
// Appending an empty field
const required = false
newitem = {
"in": "body",
"name": "body",
"multiline": true,
"description": "Generated by shuffler.io OpenAPI",
"required": required,
"example": "",
"schema": {
"type": "string",
},
}
// FIXME - add application/json if JSON example?
data.paths[item.url][item.method.toLowerCase()]["requestBody"] = {
"description": "Generated by Shuffler.io",
"required": required,
"content": {
"example": {
"example": item.body,
"example": "",
},
},
}
*/
data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem)
} else {
console.log("Nothing to append?")
}
// https://swagger.io/docs/specification/describing-request-body/file-upload/
if (item.file_field !== undefined && item.file_field !== null && item.file_field.length > 0) {
console.log("HANDLE FILEFIELD SAVE: ", item.file_field)