From 597c0b0e3d85e5d457061f4a9ecb28f793632455 Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 29 May 2021 13:57:25 +0200 Subject: [PATCH] #259: Added authentication header possibility to webhooks --- backend/go-app/go.mod | 2 +- backend/go-app/go.sum | 2 + backend/go-app/main.go | 15 +- backend/go-app/walkoff.go | 4 +- docker-compose.yml | 8 +- frontend/src/components/ParsedAction.jsx | 86 ++++---- frontend/src/defaultCytoscapeStyle.js | 16 +- frontend/src/theme.js | 8 +- frontend/src/views/Admin.jsx | 2 +- frontend/src/views/AngularWorkflow.jsx | 249 +++++++++++++++++++++-- frontend/src/views/AppCreator.jsx | 27 ++- frontend/src/views/Apps.jsx | 7 +- frontend/src/views/Workflows.jsx | 4 +- 13 files changed, 355 insertions(+), 75 deletions(-) diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index cfc22946..ea11cd21 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -24,7 +24,7 @@ require ( github.com/elastic/go-elasticsearch/v7 v7.12.0 // indirect github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb // indirect github.com/frikky/kin-openapi v0.39.0 - github.com/frikky/shuffle-shared v0.0.51 + github.com/frikky/shuffle-shared v0.0.52 github.com/fsouza/go-dockerclient v1.7.2 // indirect github.com/ghodss/yaml v1.0.0 github.com/go-git/go-billy/v5 v5.0.0 diff --git a/backend/go-app/go.sum b/backend/go-app/go.sum index 1a88952a..0f0004c7 100644 --- a/backend/go-app/go.sum +++ b/backend/go-app/go.sum @@ -161,6 +161,8 @@ github.com/frikky/shuffle-shared v0.0.50 h1:dQIXf4mwUHuEVsXiMtZaSznz6vWt+C0KjyTA github.com/frikky/shuffle-shared v0.0.50/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc= github.com/frikky/shuffle-shared v0.0.51 h1:JrCGoRNj/LkAvSlkyx7tLv7ToNtJDIAqKqiA/poO+G4= github.com/frikky/shuffle-shared v0.0.51/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc= +github.com/frikky/shuffle-shared v0.0.52 h1:sCSJl6WakYit32UjaRn0wsy4YhTBE6QZbCofYKtuATg= +github.com/frikky/shuffle-shared v0.0.52/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc= github.com/fsouza/go-dockerclient v1.7.2 h1:bBEAcqLTkpq205jooP5RVroUKiVEWgGecHyeZc4OFjo= github.com/fsouza/go-dockerclient v1.7.2/go.mod h1:+ugtMCVRwnPfY7d8/baCzZ3uwB0BrG5DB8OzbtxaRz8= github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE= diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 6abe992c..52a11b87 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -2001,6 +2001,17 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) { log.Printf("This should trigger in the cloud. Duplicate action allowed onprem.") } + // Check auth + if len(hook.Auth) > 0 { + err = shuffle.CheckHookAuth(request, hook.Auth) + if err != nil { + log.Printf("[WARNING] Failed auth for hook %s: %s", hook.Id, err) + resp.WriteHeader(401) + resp.Write([]byte(`{"success": false, "reason": "Bad authentication headers"}`)) + return + } + } + body, err := ioutil.ReadAll(request.Body) if err != nil { log.Printf("Body data error: %s", err) @@ -3262,7 +3273,7 @@ func verifySwagger(resp http.ResponseWriter, request *http.Request) { return } - log.Printf("[INFO] SETTING APP TO LIVE!!!") + log.Printf("[INFO] TRY TO SET APP TO LIVE!!!") user, err := shuffle.HandleApiAuthentication(resp, request) if err != nil { log.Printf("Api authentication failed in verify swagger: %s", err) @@ -4210,7 +4221,7 @@ func runInitEs(ctx context.Context) { // Getting apps to see if we should initialize a test workflowapps, err := shuffle.GetAllWorkflowApps(ctx, 500) - log.Printf("[INFO] Getting and validating workflowapps. Got %d with err %s", len(workflowapps), err) + log.Printf("[INFO] Getting and validating workflowapps. Got %d with err %#v", len(workflowapps), err) if err != nil && len(workflowapps) == 0 { log.Printf("[WARNING] Failed getting apps (runInit): %s", err) } else if err == nil { diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index e03ed4df..617c00d6 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -3461,7 +3461,7 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string, continue } else { appCounter += 1 - log.Printf("Added %s:%s to the database from OpenAPI repo", api.Name, api.AppVersion) + log.Printf("[INFO] Added %s:%s to the database from OpenAPI repo", api.Name, api.AppVersion) // Set OpenAPI datastore err = shuffle.SetOpenApiDatastore(ctx, parsedOpenApi.ID, parsedOpenApi) @@ -4064,7 +4064,7 @@ func setNewWorkflowApp(resp http.ResponseWriter, request *http.Request) { resp.Write([]byte(`{"success": false}`)) return } else { - log.Printf("Added %s:%s to the database", workflowapp.Name, workflowapp.AppVersion) + log.Printf("[INFO] Added %s:%s to the database", workflowapp.Name, workflowapp.AppVersion) } cacheKey := fmt.Sprintf("workflowapps-sorted-100") diff --git a/docker-compose.yml b/docker-compose.yml index 9d8cd8a1..3c24bcf6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: '3' services: frontend: - #build: ./frontend - image: ghcr.io/frikky/shuffle-frontend:0.8.93 + build: ./frontend + image: ghcr.io/frikky/shuffle-frontend:0.8.96 container_name: shuffle-frontend hostname: shuffle-frontend ports: @@ -16,8 +16,8 @@ services: depends_on: - backend backend: - #build: ./backend - image: ghcr.io/frikky/shuffle-backend:0.8.95 + build: ./backend + image: ghcr.io/frikky/shuffle-backend:0.8.96 container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME} # Here for debugging: diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 1535cfc5..8b3ec989 100644 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -12,30 +12,38 @@ import {Popper, TextField, Drawer, Button, Paper, Grid, Tabs, InputAdornment, Ta import {GetApp as GetAppIcon, Search as SearchIcon, ArrowUpward as ArrowUpwardIcon, Visibility as VisibilityIcon, Done as DoneIcon, Close as CloseIcon, Error as ErrorIcon, FindReplace as FindreplaceIcon, ArrowLeft as ArrowLeftIcon, Cached as CachedIcon, DirectionsRun as DirectionsRunIcon, Add as AddIcon, Polymer as PolymerIcon, FormatListNumbered as FormatListNumberedIcon, Create as CreateIcon, PlayArrow as PlayArrowIcon, AspectRatio as AspectRatioIcon, MoreVert as MoreVertIcon, Apps as AppsIcon, Schedule as ScheduleIcon, FavoriteBorder as FavoriteBorderIcon, Pause as PauseIcon, Delete as DeleteIcon, AddCircleOutline as AddCircleOutlineIcon, Save as SaveIcon, KeyboardArrowLeft as KeyboardArrowLeftIcon, KeyboardArrowRight as KeyboardArrowRightIcon, ArrowBack as ArrowBackIcon, Settings as SettingsIcon, LockOpen as LockOpenIcon, ExpandMore as ExpandMoreIcon, VpnKey as VpnKeyIcon} from '@material-ui/icons'; import Autocomplete from '@material-ui/lab/Autocomplete'; -const useStyles = makeStyles((theme) => - createStyles({ - root: { - "& .MuiAutocomplete-listbox": { - border: "2px solid grey", - color: "white", - fontSize: 18, - "& li:nth-child(even)": { - backgroundColor: "#CCC" - }, - "& li:nth-child(odd)": { - backgroundColor: "#FFF" - } - } - }, - inputRoot: { + +const useStyles = makeStyles({ + notchedOutline: { + borderColor: "#f85a3e !important" + }, + root: { + "& .MuiAutocomplete-listbox": { + border: "2px solid grey", color: "white", - // This matches the specificity of the default styles at https://github.com/mui-org/material-ui/blob/v4.11.3/packages/material-ui-lab/src/Autocomplete/Autocomplete.js#L90 - "&:hover .MuiOutlinedInput-notchedOutline": { - borderColor: "#f86a3e" + fontSize: 18, + "& li:nth-child(even)": { + backgroundColor: "#CCC" }, + "& li:nth-child(odd)": { + backgroundColor: "#FFF" + } } - }) -) + }, + inputRoot: { + color: "white", + // This matches the specificity of the default styles at https://github.com/mui-org/material-ui/blob/v4.11.3/packages/material-ui-lab/src/Autocomplete/Autocomplete.js#L90 + "&:hover .MuiOutlinedInput-notchedOutline": { + borderColor: "#f86a3e" + }, + } +}) +//const useStyles = makeStyles((theme) => +// createStyles({ +// notchedOutline: { +// borderColor: "#f85a3e !important" +// }, +//) const ParsedAction = (props) => { const {workflow, setWorkflow, setAction, setSelectedAction, setUpdate, appActionArguments, selectedApp, workflowExecutions, setSelectedResult, selectedAction, setSelectedApp, setSelectedTrigger, setSelectedEdge, setCurrentView, cy, setAuthenticationModalOpen,setVariablesModalOpen, setCodeModalOpen, selectedNameChange, rightsidebarStyle, showEnvironment, selectedActionEnvironment, environments, setNewSelectedAction, appApiViewStyle, globalUrl, setSelectedActionEnvironment, requiresAuthentication, hideExtraTypes, scrollConfig, setScrollConfig } = props @@ -678,11 +686,8 @@ const ParsedAction = (props) => { var datafield = { ) } - var itemColor = "#f85a3e" - if (!data.required) { - itemColor = "#ffeb3b" - } var tmpitem = data.name.valueOf() if (data.name.startsWith("${") && data.name.endsWith("}")) { tmpitem = tmpitem.slice(2, data.name.length-1) } - tmpitem = tmpitem.charAt(0).toUpperCase()+tmpitem.substring(1) - tmpitem = tmpitem.replaceAll("_", " ") + tmpitem = (tmpitem.charAt(0).toUpperCase()+tmpitem.substring(1)).replaceAll("_", " ") const description = data.description === undefined ? "" : data.description + const tooltipDescription = + + - Required: {data.required === true || data.configuration === true ? "True" : "False"} + - Example: {data.example} + - Description: {description} + + //var itemColor = "#f85a3e" + //if (!data.required) { + // itemColor = "#ffeb3b" + //} + {/*
*/} return (
@@ -1093,10 +1104,10 @@ const ParsedAction = (props) => { }}/> : -
+ null }
- + {tmpitem}
@@ -1133,12 +1144,12 @@ const ParsedAction = (props) => { */} {(selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0 && selectedActionParameters[count].required === true && selectedActionParameters[count].unique_toggled !== undefined) || hideExtraTypes ? null :
- +
{}}> { //console.log("CHECKED!: ", selectedActionParameters[count]) @@ -1235,7 +1246,7 @@ const ParsedAction = (props) => {
-

{selectedAction.app_name.replaceAll("_", " ")}

+

{(selectedAction.app_name.charAt(0).toUpperCase()+selectedAction.app_name.substring(1)).replaceAll("_", " ")}

{ console.log("FIND EXAMPLE RESULTS FOR ", selectedAction) @@ -1322,9 +1333,6 @@ const ParsedAction = (props) => { { // Need to wait because query in ES is too fast setTimeout(() => { getAppAuthentication() - }, 1000); + }, 1000) alert.success("Successfully deleted authentication!") } }), diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index e5975a77..602cec62 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -1202,8 +1202,10 @@ const AngularWorkflow = (props) => { }); } - const getWorkflow = () => { - fetch(globalUrl+"/api/v1/workflows/"+props.match.params.key, { + const getWorkflow = (workflow_id, sourcenode) => { + console.log(`Getting workflow ${workflow_id} with append value ${sourcenode}`) + + fetch(globalUrl+"/api/v1/workflows/"+workflow_id, { method: 'GET', headers: { 'Content-Type': 'application/json', @@ -1234,15 +1236,124 @@ const AngularWorkflow = (props) => { //setLastSaved(false) } - setWorkflow(responseJson) - setWorkflowDone(true) + // Appends SUBFLOWS. Does NOT run during normal grabbing of workflows. + if (sourcenode.id !== undefined) { + console.log("WORKFLOW: ", responseJson) - //console.log(responseJson) - // Add error checks - console.log("Workflow: ", responseJson) - if (!responseJson.public) { - if ((!responseJson.previously_saved || (!responseJson.is_valid || (responseJson.errors !== undefined || responseJson.errors !== null || responseJson.errors !== responseJson.errors.length > 0)))) { - setConfigureWorkflowModalOpen(true) + var nodefound = false + const target = sourcenode.parameters.find(item => item.name === "startnode") + console.log(sourcenode.parameters) + console.log(target) + const target_id = target === undefined ? "" : target.value + const actions = responseJson.actions.map(action => { + const node = { + group: "nodes", + } + + // Set it dynamically? + node.position = { + x: sourcenode.position.x+action.position.x, + y: sourcenode.position.y+action.position.y, + } + + node.data = action + + node.data._id = action["id"] + node.data.type = "ACTION" + node.data.source_workflow = responseJson.id + if (action.id === target_id) { + nodefound = true + } + + var example = "" + if (action.example !== undefined && action.example !== null && action.example.length > 0) { + example = action.example + } + + node.data.example = example + return node; + }) + + var edges = responseJson.branches.map((branch, index) => { + const edge = { }; + var conditions = responseJson.branches[index].conditions + if (conditions === undefined || conditions === null) { + conditions = [] + } + + var label = "" + if (conditions.length === 1) { + label = conditions.length+" condition" + } else if (conditions.length > 1) { + label = conditions.length+" conditions" + } + + const sourceFound = actions.findIndex(action => action.data.id === branch.source_id) + if (sourceFound < 0) { + return null + } + + const destinationFound = actions.findIndex(action => action.data.id === branch.destination_id) + if (destinationFound < 0) { + return null + } + + edge.data = { + id: branch.id, + _id: branch.id, + source: branch.source_id, + target: branch.destination_id, + label: label, + conditions: conditions, + hasErrors: branch.has_errors, + decorator: false, + source_workflow: responseJson.id, + } + + return edge; + }) + + + //console.log("Adding node: ", node) + //cy.on('add', 'node', (e) => onNodeAdded(e)) + edges = edges.filter(edge => edge !== null) + cy.removeListener('add') + cy.add(actions) + cy.add(edges) + + if (nodefound === true) { + const newId = uuid.v4() + cy.add({ + group: "edges", + data: { + id: newId, + _id: newId, + source: sourcenode.id, + target: target_id, + label: "Subflow", + decorator: true, + source_workflow: responseJson.id, + } + }) + } + + cy.fit(null, 100) + //cy.zoom(2.0) + cy.on('add', 'node', (e) => onNodeAdded(e)) + cy.on('add', 'edge', (e) => onEdgeAdded(e)) + + //for (var key in + } else { + setWorkflow(responseJson) + setWorkflowDone(true) + + //console.log(responseJson) + // Add error checks + console.log("Workflow: ", responseJson) + if (!responseJson.public) { + if ((!responseJson.previously_saved || (!responseJson.is_valid || (responseJson.errors !== undefined || responseJson.errors !== null || responseJson.errors !== responseJson.errors.length > 0)))) { + setConfigureWorkflowModalOpen(true) + } } } }) @@ -1356,6 +1467,57 @@ const AngularWorkflow = (props) => { y: 0, } + + const onCtxTap = (event) => { + const nodedata = event.target.data() + console.log(nodedata) + if (nodedata.type === "TRIGGER" && nodedata.app_name === "Shuffle Workflow") { + if (nodedata.parameters === null) { + alert.error("Set a workflow first") + return + } + + const workflow_id = nodedata.parameters.find(param => param.name === "workflow") + if (workflow.id === workflow_id.valu) { + return + } + + cy.animation({ + zoom: 0, + center: { + eles: event.target, + }, + }) + .play() + .promise() + .then( () => { + console.log("DONE: ", workflow_id) + //cy.elements().remove() + getWorkflow(workflow_id.value, nodedata) + cy.fit(null, 50) + //props.match.params.key + //cy.animation({ + // zoom: 500, + // center: { + // eles: cy.nodes(), + // }, + //}) + //.play() + //.promise() + }) + + //const animationDuration = 150 + //style: { + //maxZoom={2.00} + //cy.animate({ + // fit: 100, + //}, { + // duration: 500, + //}) + } + } + //cy.on('cxttap', "node", (e) => onCtxTap(e)) + var hiddenNodes = [] const onNodeDragStop = (event, selectedAction) => { const nodedata = event.target.data() @@ -2398,7 +2560,7 @@ const AngularWorkflow = (props) => { useEffect(() => { if (firstrequest) { setFirstrequest(false) - getWorkflow() + getWorkflow(props.match.params.key, {}) getApps() getAppAuthentication() getEnvironments() @@ -2464,6 +2626,8 @@ const AngularWorkflow = (props) => { cy.on('drag', 'node', (e) => onNodeDrag(e, selectedAction)) cy.on('free', 'node', (e) => onNodeDragStop(e, selectedAction)) + cy.on('cxttap', "node", (e) => onCtxTap(e)) + //let popper2 = cy.popper({ // content: () => { // let div = document.createElement('div'); @@ -5663,8 +5827,11 @@ const AngularWorkflow = (props) => { workflow.triggers[selectedTriggerIndex].parameters = [] workflow.triggers[selectedTriggerIndex].parameters[0] = {"name": "url", "value": referenceUrl+"webhook_"+selectedTrigger.id} workflow.triggers[selectedTriggerIndex].parameters[1] = {"name": "tmp", "value": "webhook_"+selectedTrigger.id} + workflow.triggers[selectedTriggerIndex].parameters[2] = {"name": "auth_headers", "value": ""} setWorkflow(workflow) } + + const trigger_header_auth = workflow.triggers[selectedTriggerIndex].parameters.length > 2 ? workflow.triggers[selectedTriggerIndex].parameters[2].value : "" //const cronValue = "*/15 * * * *" return( @@ -5758,6 +5925,7 @@ const AngularWorkflow = (props) => { onClick={() => { var copyText = document.getElementById("webhook_uri_field") if (copyText !== undefined && copyText !== null) { + console.log("NAVIGATOR: ", navigator) navigator.clipboard.writeText(copyText.value) copyText.select() copyText.setSelectionRange(0, 99999) /* For mobile devices */ @@ -5787,18 +5955,55 @@ const AngularWorkflow = (props) => { setTriggerCronWrapper(e.target.value) }} /> +
+
+
+ Required headers +
+
+
+ {}} + InputProps={{ + style:{ + color: "white", + marginLeft: "5px", + maxWidth: "95%", + fontSize: "1em", + }, + }} + fullWidth + multiline + rows="4" + defaultValue={trigger_header_auth} + color="primary" + placeholder={"AUTH_HEADER=AUTH_VALUE1"} + onBlur={(e) => { + const value = e.target.value + if (selectedTrigger.parameters === null) { + selectedTrigger.parameters = [] + } + + workflow.triggers[selectedTriggerIndex].parameters[2] = {"value": value, "name": "auth_headers"} + //setSelectedTrigger(workflow.triggers[selectedTr + setWorkflow(workflow) + }} + /> +
+ Start + + Stop +
@@ -5953,6 +6158,14 @@ const AngularWorkflow = (props) => { startNode = branch.destination_id } + const param = trigger.parameters.find(param => param.name === "auth_headers") + console.log("PARAM: ", param) + var auth = "" + if (param !== undefined && param !== null) { + auth = param.value + } + + console.log("TRIG: ", trigger) const data = { "name": hookname, "type": "webhook", @@ -5960,6 +6173,7 @@ const AngularWorkflow = (props) => { "workflow": workflow.id, "start": startNode, "environment": trigger.environment, + "auth": auth, } fetch(globalUrl+"/api/v1/hooks/new", { @@ -6943,6 +7157,7 @@ const AngularWorkflow = (props) => { } console.log("NEW: ", copy) + console.log("NAVIGATOR: ", navigator) navigator.clipboard.writeText(JSON.stringify(copy)) copyText.select() @@ -6993,6 +7208,7 @@ const AngularWorkflow = (props) => { const elementName = "copy_element_shuffle" var copyText = document.getElementById(elementName) if (copyText !== null && copyText !== undefined) { + console.log("NAVIGATOR: ", navigator) navigator.clipboard.writeText(to_be_copied) copyText.select() copyText.setSelectionRange(0, 99999); /* For mobile devices */ @@ -7525,6 +7741,7 @@ const AngularWorkflow = (props) => { console.log("PRECOPY: ", to_be_copied) if (copyText !== null && copyText !== undefined) { console.log("COPY: ", copyText) + console.log("NAVIGATOR: ", navigator) navigator.clipboard.writeText(to_be_copied) copyText.select(); copyText.setSelectionRange(0, 99999); /* For mobile devices */ diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index abd711ef..adea35af 100644 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -659,6 +659,11 @@ const AppCreator = (props) => { var newbody = {} for (var propkey in parameter.properties) { const parsedkey = propkey.replaceAll(" ", "_").toLowerCase() + if (parameter.properties[propkey].type === undefined) { + console.log("Skipping: ", parameter.properties[propkey]) + continue + } + if (parameter.properties[propkey].type === "string") { if (parameter.properties[propkey].description !== undefined) { newbody[parsedkey] = parameter.properties[propkey].description @@ -668,7 +673,7 @@ const AppCreator = (props) => { } else if (parameter.properties[propkey].type.includes("int")) { newbody[parsedkey] = 0 } else { - console.log("CANT HANDLE TYPE ", parameter.properties[propkey].type) + console.log("CANT HANDLE JSON TYPE ", parameter.properties[propkey].type, parameter.properties[propkey]) newbody[parsedkey] = [] } } @@ -690,6 +695,11 @@ const AppCreator = (props) => { var newbody = {} for (var propkey in parameter.properties) { const parsedkey = propkey.replaceAll(" ", "_").toLowerCase() + if (parameter.properties[propkey].type === undefined) { + console.log("Skipping: ", parameter.properties[propkey]) + continue + } + if (parameter.properties[propkey].type === "string") { if (parameter.properties[propkey].description !== undefined) { newbody[parsedkey] = parameter.properties[propkey].description @@ -699,7 +709,7 @@ const AppCreator = (props) => { } else if (parameter.properties[propkey].type.includes("int")) { newbody[parsedkey] = 0 } else { - console.log("CANT HANDLE TYPE ", parameter.properties[propkey].type) + console.log("CANT HANDLE JSON TYPE (2) ", parameter.properties[propkey].type) newbody[parsedkey] = [] } } @@ -720,16 +730,22 @@ const AppCreator = (props) => { var newbody = {} for (var propkey in parameter.properties) { const parsedkey = propkey.replaceAll(" ", "_").toLowerCase() + if (parameter.properties[propkey].type === undefined) { + console.log("Skipping: ", parameter.properties[propkey]) + continue + } + if (parameter.properties[propkey].type === "string") { if (parameter.properties[propkey].description !== undefined) { newbody[parsedkey] = parameter.properties[propkey].description } else { newbody[parsedkey] = "" } + console.log(parameter.properties[propkey]) } else if (parameter.properties[propkey].type.includes("int")) { newbody[parsedkey] = 0 } else { - console.log("CANT HANDLE TYPE ", parameter.properties[propkey].type) + console.log("CANT HANDLE JSON TYPE (3) ", parameter.properties[propkey].type) newbody[parsedkey] = [] } } @@ -882,6 +898,8 @@ const AppCreator = (props) => { if (value.scheme === "bearer") { setAuthenticationOption("Bearer auth") setAuthenticationRequired(true) + } else if (key === "oauth2") { + alert.info("Can't handle Oauth2 auth yet.") } else if (key === "ApiKeyAuth") { setAuthenticationOption("API key") @@ -1460,7 +1478,7 @@ const AppCreator = (props) => { const extraKeys =
- Extra authentication options + Add global headers or queries {extraAuth.length === 0 ?