added wrapper on models; changed handlers; fixes

This commit is contained in:
Pedro Nasser
2016-07-26 00:10:45 -03:00
parent 2578530822
commit 2489fd851f
17 changed files with 203 additions and 59 deletions

View File

@@ -0,0 +1,34 @@
package models
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
"github.com/go-openapi/errors"
)
type AppsWrapper struct {
Apps []*App `json:"apps"`
}
func (m *AppsWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateApps(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AppsWrapper) validateApps(formats strfmt.Registry) error {
if err := validate.Required("apps", "body", m.Apps); err != nil {
return err
}
return nil
}