#160: Can now read OpenApi3 variable spec for servers

This commit is contained in:
frikky
2020-09-21 18:25:09 +02:00
parent 170d9d744a
commit 09a653ee98
4 changed files with 26 additions and 14 deletions
+1 -1
View File
@@ -313,7 +313,7 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
//verifyParam := ""
//verifyWrapper := ""
//verifyAddin := ""
verifyParam := ", verify=False"
verifyParam := ", ssl_verify=False"
verifyWrapper := `if type(ssl_verify) == str: ssl_verify = False if ssl_verify.lower() == "false" or ssl_verify == "0" else True`
verifyAddin := ", verify=ssl_verify"
+1 -1
View File
@@ -16,7 +16,7 @@ services:
depends_on:
- backend
backend:
#build: ./backend
build: ./backend
image: frikky/shuffle:backend
container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME}
-1
View File
@@ -1865,7 +1865,6 @@ const AngularWorkflow = (props) => {
}
const syncEnabled = props.userdata !== undefined && props.userdata.selected_org !== null && props.userdata.selected_org !== undefined ? props.userdata.selected_org.cloud_sync === true : false
console.log("SYNC: ", syncEnabled)
const triggers = [{
"name": "Webhook",
"type": "TRIGGER",
+24 -11
View File
@@ -376,16 +376,6 @@ const AppCreator = (props) => {
}
}
if (data.servers !== undefined && data.servers.length > 0) {
var firstUrl = data.servers[0].url
if (firstUrl.endsWith("/")) {
setBaseUrl(firstUrl.slice(0, firstUrl.length-1))
} else {
setBaseUrl(firstUrl)
}
}
if (data.tags !== undefined && data.tags.length > 0) {
for (var key in data.tags) {
newWorkflowTags.push(data.tags[key].name)
@@ -425,7 +415,6 @@ const AppCreator = (props) => {
}
if (!allowedfunctions.includes(method.toUpperCase())) {
console.log(method, path)
continue
}
@@ -532,6 +521,30 @@ const AppCreator = (props) => {
}
newActions.push(newaction)
}
if (data.servers !== undefined && data.servers.length > 0) {
var firstUrl = data.servers[0].url
if (firstUrl.includes("{") && firstUrl.includes("}") && data.servers[0].variables !== undefined) {
const regex = /{\w+}/g
const found = firstUrl.match(regex)
if (found !== null) {
for (var key in found) {
const item = found[key].slice(1, found[key].length-1)
const foundVar = data.servers[0].variables[item]
if (foundVar["default"] !== undefined) {
firstUrl = firstUrl.replace(found[key], foundVar["default"])
}
}
}
}
if (firstUrl.endsWith("/")) {
setBaseUrl(firstUrl.slice(0, firstUrl.length-1))
} else {
setBaseUrl(firstUrl)
}
}
}