func (m *RestUserStateResponse) UnmarshalBinary(b []byte) error {
	var res RestUserStateResponse
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
UnmarshalBinary interface implementation
package models
import (
	"strconv"
	strfmt "github.com/go-openapi/strfmt"
	"github.com/go-openapi/errors"
	"github.com/go-openapi/swag"
)
type RestUserStateResponse struct {
	Workspaces []*IdmWorkspace `json:"Workspaces"`
	WorkspacesAccesses map[string]string `json:"WorkspacesAccesses,omitempty"`
}
func (m *RestUserStateResponse) Validate(formats strfmt.Registry) error {
	var res []error
	if err := m.validateWorkspaces(formats); err != nil {
		res = append(res, err)
	}
	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
func (m *RestUserStateResponse) validateWorkspaces(formats strfmt.Registry) error {
	if swag.IsZero(m.Workspaces) {  
		return nil
	}
	for i := 0; i < len(m.Workspaces); i++ {
		if swag.IsZero(m.Workspaces[i]) {  
			continue
		}
		if m.Workspaces[i] != nil {
			if err := m.Workspaces[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("Workspaces" + "." + strconv.Itoa(i))
				}
				return err
			}
		}
	}
	return nil
}
func (m *RestUserStateResponse) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}