This commit is contained in:
@@ -24,9 +24,6 @@ type PostParamsBody struct {
|
||||
// File to create before running commands.
|
||||
Files []apps.DirektivFile `json:"files"`
|
||||
|
||||
// json input to convert to spreadsheet
|
||||
InData interface{} `json:"in-data,omitempty"`
|
||||
|
||||
// Name of the json input file to utilise
|
||||
Infile string `json:"infile,omitempty"`
|
||||
|
||||
|
@@ -80,10 +80,6 @@ func init() {
|
||||
"$ref": "#/definitions/direktivFile"
|
||||
}
|
||||
},
|
||||
"in-data": {
|
||||
"description": "json input to convert to spreadsheet",
|
||||
"type": "object"
|
||||
},
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
@@ -156,11 +152,11 @@ func init() {
|
||||
"x-direktiv-examples": [
|
||||
{
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
||||
"title": "Rely on Direktiv to create input file"
|
||||
"title": "Basic"
|
||||
},
|
||||
{
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx\n in-data: jq(.array | tostring) ",
|
||||
"title": "Use function to create input file"
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.array | {input: . } | tostring ) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx ",
|
||||
"title": "Use jq to add a parent key 'input' containing array of objects"
|
||||
}
|
||||
],
|
||||
"x-direktiv-function": "functions:\n- id: export-xlsx\n image: registry.coadcorp.com/export-xlsx:1.0\n type: knative-workflow",
|
||||
@@ -319,11 +315,11 @@ func init() {
|
||||
"x-direktiv-examples": [
|
||||
{
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
||||
"title": "Rely on Direktiv to create input file"
|
||||
"title": "Basic"
|
||||
},
|
||||
{
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx\n in-data: jq(.array | tostring) ",
|
||||
"title": "Use function to create input file"
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.array | {input: . } | tostring ) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx ",
|
||||
"title": "Use jq to add a parent key 'input' containing array of objects"
|
||||
}
|
||||
],
|
||||
"x-direktiv-function": "functions:\n- id: export-xlsx\n image: registry.coadcorp.com/export-xlsx:1.0\n type: knative-workflow",
|
||||
@@ -404,10 +400,6 @@ func init() {
|
||||
"$ref": "#/definitions/direktivFile"
|
||||
}
|
||||
},
|
||||
"in-data": {
|
||||
"description": "json input to convert to spreadsheet",
|
||||
"type": "object"
|
||||
},
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
|
14
readme.md
14
readme.md
@@ -24,7 +24,7 @@ functions:
|
||||
image: registry.coadcorp.com/export-xlsx:1.0
|
||||
type: knative-workflow
|
||||
```
|
||||
#### Rely on Direktiv to create input file
|
||||
#### Basic
|
||||
```yaml
|
||||
- id: export-xlsx
|
||||
type: action
|
||||
@@ -38,16 +38,19 @@ functions:
|
||||
worksheet-name: "TestSpreadsheet"
|
||||
out-filename: example.xlsx
|
||||
```
|
||||
#### Use function to create input file
|
||||
#### Use jq to add a parent key 'input' containing array of objects
|
||||
```yaml
|
||||
- id: export-xlsx
|
||||
type: action
|
||||
action:
|
||||
function: export-xlsx
|
||||
input:
|
||||
input:
|
||||
files:
|
||||
- name: input.json
|
||||
data: |
|
||||
jq(.array | {input: . } | tostring )
|
||||
worksheet-name: "TestSpreadsheet"
|
||||
out-filename: example.xlsx
|
||||
in-data: jq(.array | tostring)
|
||||
out-filename: example.xlsx
|
||||
```
|
||||
|
||||
### Secrets
|
||||
@@ -113,7 +116,6 @@ functions:
|
||||
| Name | Type | Go type | Required | Default | Description | Example |
|
||||
|------|------|---------|:--------:| ------- |-------------|---------|
|
||||
| files | [][DirektivFile](#direktiv-file)| `[]apps.DirektivFile` | | | File to create before running commands. | |
|
||||
| in-data | [interface{}](#interface)| `interface{}` | | | json input to convert to spreadsheet | |
|
||||
| infile | string| `string` | | | Name of the json input file to utilise | |
|
||||
| out-filename | string| `string` | ✓ | `"output.xlsx"`| the filename of the output spreadsheet | |
|
||||
| worksheet-name | string| `string` | ✓ | `"Sheet1"`| Label for the worksheet created in the spreadsheet | |
|
||||
|
@@ -20,6 +20,8 @@ states:
|
||||
action:
|
||||
function: export-xlsx
|
||||
input:
|
||||
in-data: jq(.array | tostring)
|
||||
files:
|
||||
- data: "jq(.array | {input: . } | tostring ) \n"
|
||||
name: input.json
|
||||
out-filename: example.xlsx
|
||||
worksheet-name: TestSpreadsheet
|
||||
|
Reference in New Issue
Block a user