func (m *ExpiryCaveat) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error
	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
ContextValidate validate this expiry caveat based on the context it is used
package models
import (
	"bytes"
	"context"
	"encoding/json"
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)
type ExpiryCaveat struct {
	Duration int64 `json:"duration,omitempty"`
}
func (m *ExpiryCaveat) Type() string {
	return "ExpiryCaveat"
}
func (m *ExpiryCaveat) SetType(val string) {
}
func (m *ExpiryCaveat) UnmarshalJSON(raw []byte) error {
	var data struct {
		Duration int64 `json:"duration,omitempty"`
	}
	buf := bytes.NewBuffer(raw)
	dec := json.NewDecoder(buf)
	dec.UseNumber()
	if err := dec.Decode(&data); err != nil {
		return err
	}
	var base struct {
		Type string `json:"type"`
	}
	buf = bytes.NewBuffer(raw)
	dec = json.NewDecoder(buf)
	dec.UseNumber()
	if err := dec.Decode(&base); err != nil {
		return err
	}
	var result ExpiryCaveat
	if base.Type != result.Type() {
		return errors.New(422, "invalid type value: %q", base.Type)
	}
	result.Duration = data.Duration
	*m = result
	return nil
}
func (m ExpiryCaveat) MarshalJSON() ([]byte, error) {
	var b1, b2, b3 []byte
	var err error
	b1, err = json.Marshal(struct {
		Duration int64 `json:"duration,omitempty"`
	}{
		Duration: m.Duration,
	})
	if err != nil {
		return nil, err
	}
	b2, err = json.Marshal(struct {
		Type string `json:"type"`
	}{
		Type: m.Type(),
	})
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2, b3), nil
}
func (m *ExpiryCaveat) Validate(formats strfmt.Registry) error {
	var res []error
	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}