diff --git a/backend/go-app/codegen.go b/backend/go-app/codegen.go index c23070f3..ef7a12f2 100644 --- a/backend/go-app/codegen.go +++ b/backend/go-app/codegen.go @@ -396,10 +396,11 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet bodyAddin, verifyAddin, ) - //if strings.Contains(functionname, "get_returns_the_vuln") { - // log.Println(data) - // log.Printf("Queries: %s", queryString) - //} + + if strings.Contains(functionname, "api_dumps_delete") { + log.Println(data) + log.Printf("Queries: %s", queryString) + } //log.Printf(data) return functionname, data diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index 7dab66d4..640e1c98 100644 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -701,7 +701,7 @@ const AppCreator = (props) => { data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem) //console.log(queryitem) } - } + } if (item.paths.length > 0) { for (querykey in item.paths) { @@ -720,6 +720,30 @@ const AppCreator = (props) => { newitem.description = queryitem.description } + data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem) + //console.log(queryitem) + } + } else { + // Always goes here if they didn't click anything :/ + const values = getCurrentPaths(item.url) + const paths = values[0] + + for (querykey in paths) { + const queryitem = paths[querykey] + newitem = { + "in": "path", + "name": queryitem, + "description": "Generated by shuffler.io OpenAPI", + "required": true, + "schema": { + "type": "string", + }, + } + + if (queryitem.description !== undefined) { + newitem.description = queryitem.description + } + data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem) //console.log(queryitem) } @@ -1220,7 +1244,7 @@ const AppCreator = (props) => { return errormessage } - const UrlPathParameters = () => { + const getCurrentPaths = (urlPath) => { var paths = [] var queries = [] @@ -1296,7 +1320,16 @@ const AppCreator = (props) => { } } + return [paths, queries] + } + + const UrlPathParameters = () => { + const values = getCurrentPaths(urlPath) + const paths = values[0] + const queries = values[1] + if (currentAction.paths !== paths && urlPath.length > 0) { + console.log("IN PATHS SETTER: !", paths) setActionField("paths", paths) } @@ -1563,6 +1596,8 @@ const AppCreator = (props) => {