Fixed issue with content parsing of json in requestbody for app creator and bad multi query parsing into app
This commit is contained in:
@@ -704,8 +704,21 @@ const AppCreator = (defaultprops) => {
|
|||||||
|
|
||||||
// Typescript? I think not ;)
|
// Typescript? I think not ;)
|
||||||
if (methodvalue["requestBody"] !== undefined) {
|
if (methodvalue["requestBody"] !== undefined) {
|
||||||
//console.log("Handle requestbody: ", methodvalue["requestBody"], method, path)
|
if (methodvalue["requestBody"]["$ref"] !== undefined && methodvalue["requestBody"]["$ref"] !== null) {
|
||||||
if (methodvalue["requestBody"]["content"] !== undefined) {
|
// Handle ref
|
||||||
|
//
|
||||||
|
console.log("Ref: ", methodvalue["requestBody"]["$ref"])
|
||||||
|
const parameter = handleGetRef({ $ref: methodvalue["requestBody"]["$ref"]}, data);
|
||||||
|
console.log("PARAM: ", parameter)
|
||||||
|
if (parameter.content !== undefined && parameter.content !== null) {
|
||||||
|
methodvalue["requestBody"]["content"] = parameter.content
|
||||||
|
console.log("Set content!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (methodvalue["requestBody"]["content"] !== undefined) {
|
||||||
|
// Handle content - XML or JSON
|
||||||
|
//
|
||||||
if (
|
if (
|
||||||
methodvalue["requestBody"]["content"]["application/json"] !==
|
methodvalue["requestBody"]["content"]["application/json"] !==
|
||||||
undefined
|
undefined
|
||||||
@@ -1688,6 +1701,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
item.name = found.join("");
|
item.name = found.join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround for proper responses. No default as JSON for now
|
||||||
data.paths[item.url][item.method.toLowerCase()] = {
|
data.paths[item.url][item.method.toLowerCase()] = {
|
||||||
responses: {
|
responses: {
|
||||||
default: {
|
default: {
|
||||||
@@ -1713,11 +1727,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
|
|
||||||
//console.log("ACTION: ", item)
|
//console.log("ACTION: ", item)
|
||||||
|
|
||||||
if (
|
if (item.example_response !== undefined && item.example_response !== null && item.example_response.length > 0) {
|
||||||
item.example_response !== undefined &&
|
|
||||||
item.example_response !== null &&
|
|
||||||
item.example_response.length > 0
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (item["example_response"] === "shuffle_file_download") {
|
if (item["example_response"] === "shuffle_file_download") {
|
||||||
data.paths[item.url][item.method.toLowerCase()].responses["default"]["content"]["text/plain"].schema.type = "string"
|
data.paths[item.url][item.method.toLowerCase()].responses["default"]["content"]["text/plain"].schema.type = "string"
|
||||||
@@ -1771,9 +1781,17 @@ const AppCreator = (defaultprops) => {
|
|||||||
|
|
||||||
if (item.queries.length > 0) {
|
if (item.queries.length > 0) {
|
||||||
var skipped = false;
|
var skipped = false;
|
||||||
|
var querynames = []
|
||||||
for (var querykey in item.queries) {
|
for (var querykey in item.queries) {
|
||||||
const queryitem = item.queries[querykey];
|
const queryitem = item.queries[querykey];
|
||||||
|
|
||||||
|
// A fix for duplicate items
|
||||||
|
if (querynames.includes(queryitem.name.toLowerCase())) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
querynames.push(queryitem.name.toLowerCase())
|
||||||
|
|
||||||
if (queryitem.name.toLowerCase() == "url") {
|
if (queryitem.name.toLowerCase() == "url") {
|
||||||
console.log(item.name + " uses a bad query: url");
|
console.log(item.name + " uses a bad query: url");
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user