From 7504ea61e84e596b07fa83fda779b16ba0914e2c Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 10 Feb 2023 15:15:31 +1100 Subject: [PATCH] Update 'swagger.yaml' initial swagger definition --- swagger.yaml | 104 +++++++++++++++------------------------------------ 1 file changed, 31 insertions(+), 73 deletions(-) diff --git a/swagger.yaml b/swagger.yaml index 19600bb..914ed2b 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1,20 +1,20 @@ swagger: "2.0" info: - description: Run export-xlsx in Direktiv + description: Transform json input to xlsx spreadsheet title: export-xlsx version: "1.0" x-direktiv-meta: - container: gcr.io/direktiv/functions/export-xlsx + container: registry.coadcorp.com/export-xlsx:1.0 maintainer: |- - [direktiv.io](https://www.direktiv.io) - issues: https://github.com/direktiv-apps/export-xlsx/issues - url: https://github.com/direktiv-apps/export-xlsx + [nathan.coad@dell.com](nathan.coad@dell.com) + issues: https://git.coadcorp.com/nathan/export-xlsx/issues + url: https://git.coadcorp.com/nathan/export-xls categories: - unknown license: |- [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) long-description: >- - Run export-xlsx in Direktiv as a function + Transform json input to excel spreadsheet via json2excel command consumes: - application/json produces: @@ -56,52 +56,23 @@ paths: schema: type: object properties: - files: - type: array - items: - $ref: '#/definitions/direktivFile' - description: File to create before running commands. - default: [] - commands: - type: array - description: Array of commands. - items: - type: object - properties: - command: - type: string - description: Command to run - silent: - type: boolean - description: If set to false the command will not print output to logs. - default: false - print: - type: boolean - description: If set to false the command will not print the full command with arguments to logs. - default: true - continue: - type: boolean - description: Stops excecution if command fails, otherwise proceeds with next command - default: - - command: echo Hello + worksheet-name: + type: string + description: Label for the worksheet created in the spreadsheet + default: "Sheet1" + out-filename: + type: string + description: the filename of the output spreadsheet + default: "output.xlsx" # direktiv code generation is configured here x-direktiv-function: |- functions: - id: export-xlsx - image: gcr.io/direktiv/functions/export-xlsx:1.0 + image: registry.coadcorp.com/export-xlsx:1.0 type: knative-workflow x-direktiv-examples: # ADD MORE EXAMPLES HERE - title: Basic - content: |- - - id: export-xlsx - type: action - action: - function: export-xlsx - input: - commands: - - command: Example of running export-xlsx - - title: Advanced content: |- - id: export-xlsx type: action @@ -109,25 +80,25 @@ paths: function: export-xlsx input: files: - - name: hello.txt - data: Hello World - mode: '0755' - commands: - - command: Example of running export-xlsx + - name: input.json + data: | + jq(.input) + worksheet-name: "TestSpreadsheet" + out-filename: example.xlsx x-direktiv-secrets: - name: export-xlsxSecret description: This is a secret value x-direktiv: cmds: - - action: foreach - loop: .Commands - exec: '{{ .Item.Command }}' - silent: '{{ .Item.Silent }}' - print: '{{ .Item.Print }}' - continue: '{{ .Item.Continue }}' + - action: exec + exec: /bin/json2excel -inFile input.json -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}' + silent: false + print: true + - action: exec + exec: base64 -w 0 /tmp/{{ .OutFilename }} output: | { - "export-xlsx": {{ index . 0 | toJson }} + "export-excel": {{ (index . 1).result | toJson }} } x-direktiv-errors: io.direktiv.command.error: Command execution failed @@ -137,26 +108,13 @@ paths: 200: description: List of executed commands. examples: - export-xlsx: - - result: # EXAMPLE RESULT HERE - success: true - - result: # EXAMPLE RESULT HERE - success: true + export-excel: "JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov==" schema: type: object properties: - export-xlsx: - type: array - items: - type: object - required: - - success - - result - properties: - success: - type: boolean - result: - additionalProperties: {} + export-excel: + type: string + additionalProperties: {} default: description: generic error response headers: