Make "mappings" a required property
This was an oversight. Without this, it would be legal to have a response of {}.pull/10616/head
parent
4831ae4d29
commit
9ffb6c4489
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
/*Mappings mappings
|
||||
|
@ -17,8 +18,10 @@ swagger:model Mappings
|
|||
type Mappings struct {
|
||||
|
||||
/* mappings
|
||||
*/
|
||||
Mappings []*Mapping `json:"mappings,omitempty"`
|
||||
|
||||
Required: true
|
||||
*/
|
||||
Mappings []*Mapping `json:"mappings"`
|
||||
}
|
||||
|
||||
// Validate validates this mappings
|
||||
|
@ -38,8 +41,8 @@ func (m *Mappings) Validate(formats strfmt.Registry) error {
|
|||
|
||||
func (m *Mappings) validateMappings(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Mappings) { // not required
|
||||
return nil
|
||||
if err := validate.Required("mappings", "body", m.Mappings); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Mappings); i++ {
|
||||
|
|
|
@ -1299,6 +1299,8 @@ definitions:
|
|||
$ref: "#/definitions/Link"
|
||||
Mappings:
|
||||
type: object
|
||||
required:
|
||||
- mappings
|
||||
properties:
|
||||
mappings:
|
||||
type: array
|
||||
|
|
Loading…
Reference in New Issue