From e2b4dbca4e1c6460f0750b3fba38cd90bab3f719 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 10 Feb 2023 17:15:47 +1100 Subject: [PATCH] Update 'swagger.yaml' put files back into the input schema and adjust command list accordingly --- swagger.yaml | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/swagger.yaml b/swagger.yaml index 6e93719..81aaf5d 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -59,9 +59,15 @@ paths: - worksheet-name - out-filename properties: + files: + type: array + items: + $ref: '#/definitions/direktivFile' + description: File to create before running commands. + default: [] infile: type: string - description: Name of the json input file to utilise + description: Name of the json input file to utilise in-data: type: object description: json input to convert to spreadsheet @@ -89,7 +95,7 @@ paths: function: export-xlsx input: files: - - name: /tmp/input.json + - name: input.json data: | jq(.input) worksheet-name: "TestSpreadsheet" @@ -108,32 +114,16 @@ paths: - name: export-xlsxSecret description: This is a secret value x-direktiv: - cmds: + cmds: - action: exec - exec: ls -la + exec: /bin/json2excel -inputJson {{- if eq (deref .Infile) "" }} "input.json" {{- else }} {{ .Infile }} {{- end }} -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}' silent: false print: true - action: exec - exec: pwd - silent: false - print: true - - action: exec - exec: "/bin/bash -c \"echo '{{ .InData | toJson }}' > /tmp/input.json\"" - silent: false - print: true - - action: exec - exec: find / -name '*.json' - silent: false - print: true - - action: exec - exec: /bin/json2excel -inputJson {{- if eq (deref .Infile) "" }} "/tmp/input.json" {{- else }} {{ .Infile }} {{- end }} -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}' - silent: false - print: true - - action: exec - exec: base64 -w 0 /tmp/{{ .OutFilename }} + exec: base64 -w 0 {{ .OutFilename }} output: | { - "export-excel": {{ (index . 5).result | toJson }} + "export-excel": {{ (index . 1).result | toJson }} } x-direktiv-errors: io.direktiv.command.error: Command execution failed