func (m *GrantReq) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
MarshalBinary interface implementation
package models
import (
	"strconv"
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)
type GrantReq struct {
	BaseReq *BaseReq `json:"base_req"`
	Limit []*Coin `json:"limit"`
	Period *string `json:"period"`
}
func (m *GrantReq) Validate(formats strfmt.Registry) error {
	var res []error
	if err := m.validateBaseReq(formats); err != nil {
		res = append(res, err)
	}
	if err := m.validateLimit(formats); err != nil {
		res = append(res, err)
	}
	if err := m.validatePeriod(formats); err != nil {
		res = append(res, err)
	}
	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
func (m *GrantReq) validateBaseReq(formats strfmt.Registry) error {
	if err := validate.Required("base_req", "body", m.BaseReq); err != nil {
		return err
	}
	if m.BaseReq != nil {
		if err := m.BaseReq.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("base_req")
			}
			return err
		}
	}
	return nil
}
func (m *GrantReq) validateLimit(formats strfmt.Registry) error {
	if swag.IsZero(m.Limit) {  
		return nil
	}
	for i := 0; i < len(m.Limit); i++ {
		if swag.IsZero(m.Limit[i]) {  
			continue
		}
		if m.Limit[i] != nil {
			if err := m.Limit[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("limit" + "." + strconv.Itoa(i))
				}
				return err
			}
		}
	}
	return nil
}
func (m *GrantReq) validatePeriod(formats strfmt.Registry) error {
	if err := validate.Required("period", "body", m.Period); err != nil {
		return err
	}
	return nil
}