This commit is contained in:
@@ -68,31 +68,39 @@ func init() {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"worksheet-name",
|
||||
"out-filename"
|
||||
],
|
||||
"properties": {
|
||||
"files": {
|
||||
"description": "File to create before running commands.",
|
||||
"type": "array",
|
||||
"default": null,
|
||||
"items": {
|
||||
"$ref": "#/definitions/direktivFile"
|
||||
}
|
||||
},
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
},
|
||||
"out-filename": {
|
||||
"description": "the filename of the output spreadsheet",
|
||||
"type": "string",
|
||||
"default": "output.xlsx"
|
||||
},
|
||||
"worksheet-name": {
|
||||
"description": "Label for the worksheet created in the spreadsheet",
|
||||
"type": "string",
|
||||
"default": "Sheet1"
|
||||
"sheets": {
|
||||
"description": "Array of worksheets to create in spreadsheet",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
},
|
||||
"input-file": {
|
||||
"description": "File to create before running commands",
|
||||
"type": "array",
|
||||
"default": null,
|
||||
"items": {
|
||||
"$ref": "#/definitions/direktivFile"
|
||||
}
|
||||
},
|
||||
"worksheet-name": {
|
||||
"description": "Label for the worksheet created in the spreadsheet",
|
||||
"type": "string",
|
||||
"default": "Sheet1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,8 +140,9 @@ func init() {
|
||||
"x-direktiv": {
|
||||
"cmds": [
|
||||
{
|
||||
"action": "exec",
|
||||
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"input.json\" {{- else }} {{ .Infile }} {{- end }} -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"action": "foreach",
|
||||
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Item.Infile) \"\" }} \"input.json\" {{- else }} {{ .Item.Infile }} {{- end }} -worksheetName \"{{ .Item.WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"loop": ".Sheets",
|
||||
"print": true,
|
||||
"silent": false
|
||||
},
|
||||
@@ -151,11 +160,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",
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n out-filename: example.xlsx\n sheets:\n - sheet:\n worksheet-name: \"TestSpreadsheet\"\n input-file:\n - name: input.json\n data: |\n jq(.input)",
|
||||
"title": "Basic"
|
||||
},
|
||||
{
|
||||
"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 ",
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n out-filename: example.xlsx \n sheets:\n - sheet:\n worksheet-name: \"TestSpreadsheet\"\n input-file:\n - name: input.json\n data: |\n jq(.array | {input: . } | tostring ) ",
|
||||
"title": "Use jq to add a parent key 'input' containing array of objects"
|
||||
}
|
||||
],
|
||||
@@ -295,8 +304,9 @@ func init() {
|
||||
"x-direktiv": {
|
||||
"cmds": [
|
||||
{
|
||||
"action": "exec",
|
||||
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"input.json\" {{- else }} {{ .Infile }} {{- end }} -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"action": "foreach",
|
||||
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Item.Infile) \"\" }} \"input.json\" {{- else }} {{ .Item.Infile }} {{- end }} -worksheetName \"{{ .Item.WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"loop": ".Sheets",
|
||||
"print": true,
|
||||
"silent": false
|
||||
},
|
||||
@@ -314,11 +324,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",
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n out-filename: example.xlsx\n sheets:\n - sheet:\n worksheet-name: \"TestSpreadsheet\"\n input-file:\n - name: input.json\n data: |\n jq(.input)",
|
||||
"title": "Basic"
|
||||
},
|
||||
{
|
||||
"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 ",
|
||||
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n out-filename: example.xlsx \n sheets:\n - sheet:\n worksheet-name: \"TestSpreadsheet\"\n input-file:\n - name: input.json\n data: |\n jq(.array | {input: . } | tostring ) ",
|
||||
"title": "Use jq to add a parent key 'input' containing array of objects"
|
||||
}
|
||||
],
|
||||
@@ -388,27 +398,39 @@ func init() {
|
||||
"postParamsBody": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"worksheet-name",
|
||||
"out-filename"
|
||||
],
|
||||
"properties": {
|
||||
"files": {
|
||||
"description": "File to create before running commands.",
|
||||
"out-filename": {
|
||||
"description": "the filename of the output spreadsheet",
|
||||
"type": "string",
|
||||
"default": "output.xlsx"
|
||||
},
|
||||
"sheets": {
|
||||
"description": "Array of worksheets to create in spreadsheet",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/postParamsBodySheetsItems"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-go-gen-location": "operations"
|
||||
},
|
||||
"postParamsBodySheetsItems": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
},
|
||||
"input-file": {
|
||||
"description": "File to create before running commands",
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/direktivFile"
|
||||
}
|
||||
},
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
},
|
||||
"out-filename": {
|
||||
"description": "the filename of the output spreadsheet",
|
||||
"type": "string",
|
||||
"default": "output.xlsx"
|
||||
},
|
||||
"worksheet-name": {
|
||||
"description": "Label for the worksheet created in the spreadsheet",
|
||||
"type": "string",
|
||||
|
Reference in New Issue
Block a user