add new field in swagger
This commit is contained in:
parent
21f83b6a0f
commit
e96a267144
2 changed files with 46 additions and 1 deletions
|
@ -6,6 +6,8 @@ package models
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
@ -17,7 +19,7 @@ import (
|
|||
// swagger:model Decision
|
||||
type Decision struct {
|
||||
|
||||
// duration
|
||||
// the duration of the decisions
|
||||
// Required: true
|
||||
Duration *string `json:"duration"`
|
||||
|
||||
|
@ -45,6 +47,9 @@ type Decision struct {
|
|||
// Required: true
|
||||
Type *string `json:"type"`
|
||||
|
||||
// the date until the decisions must be active
|
||||
Until string `json:"until,omitempty"`
|
||||
|
||||
// the value of the decision scope : an IP, a range, a username, etc
|
||||
// Required: true
|
||||
Value *string `json:"value"`
|
||||
|
@ -138,6 +143,42 @@ func (m *Decision) validateValue(formats strfmt.Registry) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this decision based on the context it is used
|
||||
func (m *Decision) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateID(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSimulated(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Decision) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Decision) contextValidateSimulated(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.ReadOnly(ctx, "simulated", "body", m.Simulated); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Decision) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
|
|
@ -831,7 +831,11 @@ definitions:
|
|||
description: 'the value of the decision scope : an IP, a range, a username, etc'
|
||||
type: string
|
||||
duration:
|
||||
description: 'the duration of the decisions'
|
||||
type: string
|
||||
until:
|
||||
type: string
|
||||
description: 'the date until the decisions must be active'
|
||||
scenario:
|
||||
type: string
|
||||
simulated:
|
||||
|
|
Loading…
Reference in a new issue