func (m *Entity) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
MarshalBinary interface implementation
package models
import (
	strfmt "github.com/go-openapi/strfmt"
	"github.com/go-openapi/errors"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)
type Entity struct {
	ID *string `json:"id"`
	Rev *string `json:"rev"`
	Metadata
}
func (m *Entity) UnmarshalJSON(raw []byte) error {
	var dataAO0 struct {
		ID *string `json:"id"`
		Rev *string `json:"rev"`
	}
	if err := swag.ReadJSON(raw, &dataAO0); err != nil {
		return err
	}
	m.ID = dataAO0.ID
	m.Rev = dataAO0.Rev
	var aO1 Metadata
	if err := swag.ReadJSON(raw, &aO1); err != nil {
		return err
	}
	m.Metadata = aO1
	return nil
}
func (m Entity) MarshalJSON() ([]byte, error) {
	_parts := make([][]byte, 0, 2)
	var dataAO0 struct {
		ID *string `json:"id"`
		Rev *string `json:"rev"`
	}
	dataAO0.ID = m.ID
	dataAO0.Rev = m.Rev
	jsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)
	if errAO0 != nil {
		return nil, errAO0
	}
	_parts = append(_parts, jsonDataAO0)
	aO1, err := swag.WriteJSON(m.Metadata)
	if err != nil {
		return nil, err
	}
	_parts = append(_parts, aO1)
	return swag.ConcatJSON(_parts...), nil
}
func (m *Entity) Validate(formats strfmt.Registry) error {
	var res []error
	if err := m.validateID(formats); err != nil {
		res = append(res, err)
	}
	if err := m.validateRev(formats); err != nil {
		res = append(res, err)
	}
	if err := m.Metadata.Validate(formats); err != nil {
		res = append(res, err)
	}
	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
func (m *Entity) validateID(formats strfmt.Registry) error {
	if err := validate.Required("id", "body", m.ID); err != nil {
		return err
	}
	return nil
}
func (m *Entity) validateRev(formats strfmt.Registry) error {
	if err := validate.Required("rev", "body", m.Rev); err != nil {
		return err
	}
	return nil
}