Started fixing requestbody in openapi3
This commit is contained in:
@@ -272,7 +272,7 @@ const AppCreator = (props) => {
|
||||
return response.json()
|
||||
})
|
||||
.then((responseJson) => {
|
||||
setIsAppLoaded(true)
|
||||
setIsAppLoaded(true)
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to get the app")
|
||||
} else {
|
||||
@@ -346,10 +346,8 @@ const AppCreator = (props) => {
|
||||
setDescription(data.info.description)
|
||||
document.title = "Apps - "+data.info.title
|
||||
|
||||
console.log(data.info["x-logo"])
|
||||
if (data.info !== null && data.info !== undefined && data.info["x-logo"] !== undefined) {
|
||||
setFileBase64(data.info["x-logo"])
|
||||
console.log("IMG: ", data.inf0["x-logo"])
|
||||
}
|
||||
|
||||
if (data.info.contact != undefined) {
|
||||
@@ -360,8 +358,6 @@ const AppCreator = (props) => {
|
||||
setBaseUrl(data.servers[0].url)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This is annoying (:
|
||||
var securitySchemes = data.components.securityDefinitions
|
||||
if (securitySchemes === undefined) {
|
||||
@@ -396,6 +392,8 @@ const AppCreator = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(data)
|
||||
|
||||
// FIXME - headers?
|
||||
var newActions = []
|
||||
for (let [path, pathvalue] of Object.entries(data.paths)) {
|
||||
@@ -412,6 +410,7 @@ const AppCreator = (props) => {
|
||||
"errors": [],
|
||||
}
|
||||
|
||||
|
||||
for (var key in methodvalue.parameters) {
|
||||
const parameter = methodvalue.parameters[key]
|
||||
if (parameter.in === "query") {
|
||||
@@ -450,7 +449,6 @@ const AppCreator = (props) => {
|
||||
const host = splitBase[2]
|
||||
const schemes = [splitBase[0]]
|
||||
const basePath = "/"+(splitBase.slice(3, )).join("/")
|
||||
console.log("IMAGE: ", fileBase64)
|
||||
|
||||
const data = {
|
||||
"swagger": "3.0",
|
||||
@@ -557,19 +555,32 @@ const AppCreator = (props) => {
|
||||
}
|
||||
|
||||
if (item.body.length > 0) {
|
||||
console.log("HANDLE BODY!")
|
||||
const required = false
|
||||
newitem = {
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"multiline": true,
|
||||
"description": "Generated by shuffler.io OpenAPI",
|
||||
"required": false,
|
||||
"required": required,
|
||||
"example": item.body,
|
||||
"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": "test",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
console.log(data.paths[item.url][item.method.toLowerCase()])
|
||||
|
||||
data.paths[item.url][item.method.toLowerCase()].parameters.push(newitem)
|
||||
}
|
||||
}
|
||||
@@ -615,7 +626,6 @@ const AppCreator = (props) => {
|
||||
setErrorCode(responseJson.reason)
|
||||
alert.error("Failed to verify: ")
|
||||
} else {
|
||||
// Return?
|
||||
alert.success("Successfully uploaded openapi")
|
||||
//window.location = "/apps"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user