This commit is contained in:
@@ -8,8 +8,10 @@ package models
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/errors"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
"github.com/go-openapi/swag"
|
"github.com/go-openapi/swag"
|
||||||
|
"github.com/go-openapi/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PostParamsBody post params body
|
// PostParamsBody post params body
|
||||||
@@ -21,14 +23,47 @@ type PostParamsBody struct {
|
|||||||
Infile string `json:"infile,omitempty"`
|
Infile string `json:"infile,omitempty"`
|
||||||
|
|
||||||
// the filename of the output spreadsheet
|
// the filename of the output spreadsheet
|
||||||
OutFilename *string `json:"out-filename,omitempty"`
|
// Required: true
|
||||||
|
OutFilename *string `json:"out-filename"`
|
||||||
|
|
||||||
// Label for the worksheet created in the spreadsheet
|
// Label for the worksheet created in the spreadsheet
|
||||||
WorksheetName *string `json:"worksheet-name,omitempty"`
|
// Required: true
|
||||||
|
WorksheetName *string `json:"worksheet-name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates this post params body
|
// Validate validates this post params body
|
||||||
func (m *PostParamsBody) Validate(formats strfmt.Registry) error {
|
func (m *PostParamsBody) Validate(formats strfmt.Registry) error {
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if err := m.validateOutFilename(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := m.validateWorksheetName(formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PostParamsBody) validateOutFilename(formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := validate.Required("out-filename", "body", m.OutFilename); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PostParamsBody) validateWorksheetName(formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := validate.Required("worksheet-name", "body", m.WorksheetName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -67,6 +67,10 @@ func init() {
|
|||||||
"in": "body",
|
"in": "body",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"worksheet-name",
|
||||||
|
"out-filename"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"infile": {
|
"infile": {
|
||||||
"description": "Name of the json input file to utilise",
|
"description": "Name of the json input file to utilise",
|
||||||
@@ -99,7 +103,7 @@ func init() {
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"export-excel": "JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov=="
|
"export-excel": "{\"export-excel\": \"JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov==\"}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
@@ -258,7 +262,7 @@ func init() {
|
|||||||
"$ref": "#/definitions/postOKBody"
|
"$ref": "#/definitions/postOKBody"
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"export-excel": "JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov=="
|
"export-excel": "{\"export-excel\": \"JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov==\"}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
@@ -367,6 +371,10 @@ func init() {
|
|||||||
},
|
},
|
||||||
"postParamsBody": {
|
"postParamsBody": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"worksheet-name",
|
||||||
|
"out-filename"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"infile": {
|
"infile": {
|
||||||
"description": "Name of the json input file to utilise",
|
"description": "Name of the json input file to utilise",
|
||||||
|
@@ -66,7 +66,7 @@ functions:
|
|||||||
#### Example Reponses
|
#### Example Reponses
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov=="
|
"{\"export-excel\": \"JVBERi0xLjUKJdDUxdgKNSAwIG9iago8PAov==\"}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Errors
|
### Errors
|
||||||
@@ -102,7 +102,7 @@ functions:
|
|||||||
| Name | Type | Go type | Required | Default | Description | Example |
|
| Name | Type | Go type | Required | Default | Description | Example |
|
||||||
|------|------|---------|:--------:| ------- |-------------|---------|
|
|------|------|---------|:--------:| ------- |-------------|---------|
|
||||||
| infile | string| `string` | | | Name of the json input file to utilise | |
|
| infile | string| `string` | | | Name of the json input file to utilise | |
|
||||||
| out-filename | string| `string` | | `"output.xlsx"`| the filename of the output spreadsheet | |
|
| 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 | |
|
| worksheet-name | string| `string` | ✓ | `"Sheet1"`| Label for the worksheet created in the spreadsheet | |
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user