functionbuilder
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nathan Coad
2023-02-10 16:09:47 +11:00
parent 28e7716f18
commit be85034466
3 changed files with 50 additions and 7 deletions

View File

@@ -8,8 +8,10 @@ package models
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// PostParamsBody post params body
@@ -21,14 +23,47 @@ type PostParamsBody struct {
Infile string `json:"infile,omitempty"`
// 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
WorksheetName *string `json:"worksheet-name,omitempty"`
// Required: true
WorksheetName *string `json:"worksheet-name"`
}
// Validate validates this post params body
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
}