Fixed minor bugs in app creator bodies and action names + added auto addition of headers
This commit is contained in:
@@ -1814,6 +1814,10 @@ const AppCreator = (defaultprops) => {
|
||||
for (var querykey in item.queries) {
|
||||
const queryitem = item.queries[querykey];
|
||||
|
||||
if (queryitem === undefined || queryitem === null || queryitem.name === undefined || queryitem.name === null) {
|
||||
continue
|
||||
}
|
||||
|
||||
// A fix for duplicate items
|
||||
if (querynames.includes(queryitem.name.toLowerCase())) {
|
||||
continue
|
||||
@@ -1967,70 +1971,76 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
item.body !== undefined &&
|
||||
item.body !== null &&
|
||||
item.body.length > 0
|
||||
) {
|
||||
const required = false;
|
||||
newitem = {
|
||||
in: "body",
|
||||
name: "body",
|
||||
multiline: true,
|
||||
description: "Generated by shuffler.io OpenAPI",
|
||||
required: required,
|
||||
example: item.body,
|
||||
schema: {
|
||||
type: "string",
|
||||
},
|
||||
};
|
||||
const methodname = item.method.toLowerCase()
|
||||
if (methodname === "post" || methodname === "put" || methodname === "patch") {
|
||||
if (
|
||||
item.body !== undefined &&
|
||||
item.body !== null &&
|
||||
item.body.length > 0
|
||||
) {
|
||||
console.log("GOT BODY: ", item.url, item.method)
|
||||
//var pathjoin = item.url+"_"+item.method.toLowerCase()
|
||||
|
||||
// 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,
|
||||
},
|
||||
},
|
||||
};
|
||||
const required = false;
|
||||
newitem = {
|
||||
in: "body",
|
||||
name: "body",
|
||||
multiline: true,
|
||||
description: "Generated by shuffler.io OpenAPI",
|
||||
required: required,
|
||||
example: item.body,
|
||||
schema: {
|
||||
type: "string",
|
||||
},
|
||||
};
|
||||
|
||||
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,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 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: "",
|
||||
},
|
||||
},
|
||||
};
|
||||
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",
|
||||
},
|
||||
};
|
||||
|
||||
data.paths[item.url][item.method.toLowerCase()].parameters.push(
|
||||
newitem
|
||||
);
|
||||
} else {
|
||||
//console.log("Nothing to append?")
|
||||
}
|
||||
// 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: "",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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 (
|
||||
|
||||
Reference in New Issue
Block a user