func (p *TypeProperty) Types() []Type {
	if p == nil {
		return nil
	}
	return p.types
}
Types returns all types.
package vocab
import (
	"encoding/json"
	"fmt"
)
type TypeProperty struct {
	types []Type
}
func NewTypeProperty(t ...Type) *TypeProperty {
	if len(t) == 0 {
		return nil
	}
	return &TypeProperty{types: t}
}
func (p *TypeProperty) MarshalJSON() ([]byte, error) {
	if len(p.types) == 1 {
		return json.Marshal(p.types[0])
	}
	return json.Marshal(p.types)
}
func (p *TypeProperty) UnmarshalJSON(bytes []byte) error {
	var ctx Type
	err := json.Unmarshal(bytes, &ctx)
	if err == nil {
		p.types = []Type{ctx}
		return nil
	}
	var types []Type
	err = json.Unmarshal(bytes, &types)
	if err != nil {
		return err
	}
	p.types = types
	return nil
}
func (p *TypeProperty) String() string {
	if p == nil || len(p.types) == 0 {
		return ""
	}
	if len(p.types) == 1 {
		return string(p.types[0])
	}
	return fmt.Sprintf("%s", p.types)
}