func UnmarshalIdentity(reader io.Reader, consumer runtime.Consumer) (Identity, error) {
	data, err := ioutil.ReadAll(reader)
	if err != nil {
		return nil, err
	}
	return unmarshalIdentity(data, consumer)
}
UnmarshalIdentity unmarshals polymorphic Identity
package models
import (
	"bytes"
	"encoding/json"
	"io"
	"io/ioutil"
	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/validate"
)
type Identity interface {
	runtime.Validatable
	Type() string
	SetType(string)
}
func UnmarshalIdentitySlice(reader io.Reader, consumer runtime.Consumer) ([]Identity, error) {
	var elements []json.RawMessage
	if err := consumer.Consume(reader, &elements); err != nil {
		return nil, err
	}
	var result []Identity
	for _, element := range elements {
		obj, err := unmarshalIdentity(element, consumer)
		if err != nil {
			return nil, err
		}
		result = append(result, obj)
	}
	return result, nil
}