// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.

package tangled

import (
	"fmt"
	"io"
	"math"
	"sort"

	util "github.com/bluesky-social/indigo/lex/util"
	cid "github.com/ipfs/go-cid"
	cbg "github.com/whyrusleeping/cbor-gen"
	xerrors "golang.org/x/xerrors"
)

var _ = xerrors.Errorf
var _ = cid.Undef
var _ = math.E
var _ = sort.Sort

func (t *ActorProfile) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 9

	if t.Avatar == nil {
		fieldCount--
	}

	if t.Description == nil {
		fieldCount--
	}

	if t.Links == nil {
		fieldCount--
	}

	if t.Location == nil {
		fieldCount--
	}

	if t.PinnedRepositories == nil {
		fieldCount--
	}

	if t.Pronouns == nil {
		fieldCount--
	}

	if t.Stats == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.actor.profile"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.actor.profile")); err != nil {
		return err
	}

	// t.Links ([]string) (slice)
	if t.Links != nil {

		if len("links") > 1000000 {
			return xerrors.Errorf("Value in field \"links\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("links"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("links")); err != nil {
			return err
		}

		if len(t.Links) > 8192 {
			return xerrors.Errorf("Slice value in field t.Links was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Links))); err != nil {
			return err
		}
		for _, v := range t.Links {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.Stats ([]string) (slice)
	if t.Stats != nil {

		if len("stats") > 1000000 {
			return xerrors.Errorf("Value in field \"stats\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("stats"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("stats")); err != nil {
			return err
		}

		if len(t.Stats) > 8192 {
			return xerrors.Errorf("Slice value in field t.Stats was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Stats))); err != nil {
			return err
		}
		for _, v := range t.Stats {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.Avatar (util.LexBlob) (struct)
	if t.Avatar != nil {

		if len("avatar") > 1000000 {
			return xerrors.Errorf("Value in field \"avatar\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("avatar"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("avatar")); err != nil {
			return err
		}

		if err := t.Avatar.MarshalCBOR(cw); err != nil {
			return err
		}
	}

	// t.Bluesky (bool) (bool)
	if len("bluesky") > 1000000 {
		return xerrors.Errorf("Value in field \"bluesky\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("bluesky"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("bluesky")); err != nil {
		return err
	}

	if err := cbg.WriteBool(w, t.Bluesky); err != nil {
		return err
	}

	// t.Location (string) (string)
	if t.Location != nil {

		if len("location") > 1000000 {
			return xerrors.Errorf("Value in field \"location\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("location"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("location")); err != nil {
			return err
		}

		if t.Location == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Location) > 1000000 {
				return xerrors.Errorf("Value in field t.Location was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Location))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Location)); err != nil {
				return err
			}
		}
	}

	// t.Pronouns (string) (string)
	if t.Pronouns != nil {

		if len("pronouns") > 1000000 {
			return xerrors.Errorf("Value in field \"pronouns\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pronouns"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("pronouns")); err != nil {
			return err
		}

		if t.Pronouns == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Pronouns) > 1000000 {
				return xerrors.Errorf("Value in field t.Pronouns was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Pronouns))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Pronouns)); err != nil {
				return err
			}
		}
	}

	// t.Description (string) (string)
	if t.Description != nil {

		if len("description") > 1000000 {
			return xerrors.Errorf("Value in field \"description\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("description")); err != nil {
			return err
		}

		if t.Description == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Description) > 1000000 {
				return xerrors.Errorf("Value in field t.Description was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Description)); err != nil {
				return err
			}
		}
	}

	// t.PinnedRepositories ([]string) (slice)
	if t.PinnedRepositories != nil {

		if len("pinnedRepositories") > 1000000 {
			return xerrors.Errorf("Value in field \"pinnedRepositories\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pinnedRepositories"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("pinnedRepositories")); err != nil {
			return err
		}

		if len(t.PinnedRepositories) > 8192 {
			return xerrors.Errorf("Slice value in field t.PinnedRepositories was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.PinnedRepositories))); err != nil {
			return err
		}
		for _, v := range t.PinnedRepositories {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *ActorProfile) UnmarshalCBOR(r io.Reader) (err error) {
	*t = ActorProfile{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("ActorProfile: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 18)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Links ([]string) (slice)
		case "links":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Links: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Links = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Links[i] = string(sval)
					}

				}
			}
			// t.Stats ([]string) (slice)
		case "stats":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Stats: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Stats = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Stats[i] = string(sval)
					}

				}
			}
			// t.Avatar (util.LexBlob) (struct)
		case "avatar":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Avatar = new(util.LexBlob)
					if err := t.Avatar.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Avatar pointer: %w", err)
					}
				}

			}
			// t.Bluesky (bool) (bool)
		case "bluesky":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}
			if maj != cbg.MajOther {
				return fmt.Errorf("booleans must be major type 7")
			}
			switch extra {
			case 20:
				t.Bluesky = false
			case 21:
				t.Bluesky = true
			default:
				return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
			}
			// t.Location (string) (string)
		case "location":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Location = (*string)(&sval)
				}
			}
			// t.Pronouns (string) (string)
		case "pronouns":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Pronouns = (*string)(&sval)
				}
			}
			// t.Description (string) (string)
		case "description":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Description = (*string)(&sval)
				}
			}
			// t.PinnedRepositories ([]string) (slice)
		case "pinnedRepositories":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.PinnedRepositories: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.PinnedRepositories = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.PinnedRepositories[i] = string(sval)
					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *FeedReaction) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.feed.reaction"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.feed.reaction")); err != nil {
		return err
	}

	// t.Subject (string) (string)
	if len("subject") > 1000000 {
		return xerrors.Errorf("Value in field \"subject\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("subject")); err != nil {
		return err
	}

	if len(t.Subject) > 1000000 {
		return xerrors.Errorf("Value in field t.Subject was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Subject)); err != nil {
		return err
	}

	// t.Reaction (string) (string)
	if len("reaction") > 1000000 {
		return xerrors.Errorf("Value in field \"reaction\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("reaction"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("reaction")); err != nil {
		return err
	}

	if len(t.Reaction) > 1000000 {
		return xerrors.Errorf("Value in field t.Reaction was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Reaction))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Reaction)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *FeedReaction) UnmarshalCBOR(r io.Reader) (err error) {
	*t = FeedReaction{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("FeedReaction: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Subject (string) (string)
		case "subject":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Subject = string(sval)
			}
			// t.Reaction (string) (string)
		case "reaction":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Reaction = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *FeedStar) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{163}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.feed.star"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.feed.star")); err != nil {
		return err
	}

	// t.Subject (string) (string)
	if len("subject") > 1000000 {
		return xerrors.Errorf("Value in field \"subject\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("subject")); err != nil {
		return err
	}

	if len(t.Subject) > 1000000 {
		return xerrors.Errorf("Value in field t.Subject was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Subject)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *FeedStar) UnmarshalCBOR(r io.Reader) (err error) {
	*t = FeedStar{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("FeedStar: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Subject (string) (string)
		case "subject":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Subject = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *GitRefUpdate) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{168}); err != nil {
		return err
	}

	// t.Ref (string) (string)
	if len("ref") > 1000000 {
		return xerrors.Errorf("Value in field \"ref\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("ref")); err != nil {
		return err
	}

	if len(t.Ref) > 1000000 {
		return xerrors.Errorf("Value in field t.Ref was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Ref)); err != nil {
		return err
	}

	// t.Meta (tangled.GitRefUpdate_Meta) (struct)
	if len("meta") > 1000000 {
		return xerrors.Errorf("Value in field \"meta\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("meta"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("meta")); err != nil {
		return err
	}

	if err := t.Meta.MarshalCBOR(cw); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.git.refUpdate"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.git.refUpdate")); err != nil {
		return err
	}

	// t.NewSha (string) (string)
	if len("newSha") > 1000000 {
		return xerrors.Errorf("Value in field \"newSha\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("newSha")); err != nil {
		return err
	}

	if len(t.NewSha) > 1000000 {
		return xerrors.Errorf("Value in field t.NewSha was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.NewSha)); err != nil {
		return err
	}

	// t.OldSha (string) (string)
	if len("oldSha") > 1000000 {
		return xerrors.Errorf("Value in field \"oldSha\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("oldSha")); err != nil {
		return err
	}

	if len(t.OldSha) > 1000000 {
		return xerrors.Errorf("Value in field t.OldSha was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.OldSha)); err != nil {
		return err
	}

	// t.RepoDid (string) (string)
	if len("repoDid") > 1000000 {
		return xerrors.Errorf("Value in field \"repoDid\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repoDid")); err != nil {
		return err
	}

	if len(t.RepoDid) > 1000000 {
		return xerrors.Errorf("Value in field t.RepoDid was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoDid))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.RepoDid)); err != nil {
		return err
	}

	// t.RepoName (string) (string)
	if len("repoName") > 1000000 {
		return xerrors.Errorf("Value in field \"repoName\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoName"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repoName")); err != nil {
		return err
	}

	if len(t.RepoName) > 1000000 {
		return xerrors.Errorf("Value in field t.RepoName was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoName))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.RepoName)); err != nil {
		return err
	}

	// t.CommitterDid (string) (string)
	if len("committerDid") > 1000000 {
		return xerrors.Errorf("Value in field \"committerDid\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("committerDid"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("committerDid")); err != nil {
		return err
	}

	if len(t.CommitterDid) > 1000000 {
		return xerrors.Errorf("Value in field t.CommitterDid was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CommitterDid))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CommitterDid)); err != nil {
		return err
	}
	return nil
}

func (t *GitRefUpdate) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GitRefUpdate{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("GitRefUpdate: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 12)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Ref (string) (string)
		case "ref":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Ref = string(sval)
			}
			// t.Meta (tangled.GitRefUpdate_Meta) (struct)
		case "meta":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Meta = new(GitRefUpdate_Meta)
					if err := t.Meta.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Meta pointer: %w", err)
					}
				}

			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.NewSha (string) (string)
		case "newSha":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.NewSha = string(sval)
			}
			// t.OldSha (string) (string)
		case "oldSha":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.OldSha = string(sval)
			}
			// t.RepoDid (string) (string)
		case "repoDid":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.RepoDid = string(sval)
			}
			// t.RepoName (string) (string)
		case "repoName":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.RepoName = string(sval)
			}
			// t.CommitterDid (string) (string)
		case "committerDid":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CommitterDid = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *GitRefUpdate_CommitCountBreakdown) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 1

	if t.ByEmail == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.ByEmail ([]*tangled.GitRefUpdate_IndividualEmailCommitCount) (slice)
	if t.ByEmail != nil {

		if len("byEmail") > 1000000 {
			return xerrors.Errorf("Value in field \"byEmail\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("byEmail"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("byEmail")); err != nil {
			return err
		}

		if len(t.ByEmail) > 8192 {
			return xerrors.Errorf("Slice value in field t.ByEmail was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.ByEmail))); err != nil {
			return err
		}
		for _, v := range t.ByEmail {
			if err := v.MarshalCBOR(cw); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *GitRefUpdate_CommitCountBreakdown) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GitRefUpdate_CommitCountBreakdown{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("GitRefUpdate_CommitCountBreakdown: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 7)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.ByEmail ([]*tangled.GitRefUpdate_IndividualEmailCommitCount) (slice)
		case "byEmail":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.ByEmail: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.ByEmail = make([]*GitRefUpdate_IndividualEmailCommitCount, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{

						b, err := cr.ReadByte()
						if err != nil {
							return err
						}
						if b != cbg.CborNull[0] {
							if err := cr.UnreadByte(); err != nil {
								return err
							}
							t.ByEmail[i] = new(GitRefUpdate_IndividualEmailCommitCount)
							if err := t.ByEmail[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.ByEmail[i] pointer: %w", err)
							}
						}

					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *GitRefUpdate_IndividualEmailCommitCount) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{162}); err != nil {
		return err
	}

	// t.Count (int64) (int64)
	if len("count") > 1000000 {
		return xerrors.Errorf("Value in field \"count\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("count"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("count")); err != nil {
		return err
	}

	if t.Count >= 0 {
		if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Count)); err != nil {
			return err
		}
	} else {
		if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Count-1)); err != nil {
			return err
		}
	}

	// t.Email (string) (string)
	if len("email") > 1000000 {
		return xerrors.Errorf("Value in field \"email\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("email"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("email")); err != nil {
		return err
	}

	if len(t.Email) > 1000000 {
		return xerrors.Errorf("Value in field t.Email was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Email))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Email)); err != nil {
		return err
	}
	return nil
}

func (t *GitRefUpdate_IndividualEmailCommitCount) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GitRefUpdate_IndividualEmailCommitCount{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("GitRefUpdate_IndividualEmailCommitCount: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 5)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Count (int64) (int64)
		case "count":
			{
				maj, extra, err := cr.ReadHeader()
				if err != nil {
					return err
				}
				var extraI int64
				switch maj {
				case cbg.MajUnsignedInt:
					extraI = int64(extra)
					if extraI < 0 {
						return fmt.Errorf("int64 positive overflow")
					}
				case cbg.MajNegativeInt:
					extraI = int64(extra)
					if extraI < 0 {
						return fmt.Errorf("int64 negative overflow")
					}
					extraI = -1 - extraI
				default:
					return fmt.Errorf("wrong type for int64 field: %d", maj)
				}

				t.Count = int64(extraI)
			}
			// t.Email (string) (string)
		case "email":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Email = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *GitRefUpdate_IndividualLanguageSize) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{162}); err != nil {
		return err
	}

	// t.Lang (string) (string)
	if len("lang") > 1000000 {
		return xerrors.Errorf("Value in field \"lang\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("lang"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("lang")); err != nil {
		return err
	}

	if len(t.Lang) > 1000000 {
		return xerrors.Errorf("Value in field t.Lang was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Lang))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Lang)); err != nil {
		return err
	}

	// t.Size (int64) (int64)
	if len("size") > 1000000 {
		return xerrors.Errorf("Value in field \"size\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("size"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("size")); err != nil {
		return err
	}

	if t.Size >= 0 {
		if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil {
			return err
		}
	} else {
		if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Size-1)); err != nil {
			return err
		}
	}

	return nil
}

func (t *GitRefUpdate_IndividualLanguageSize) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GitRefUpdate_IndividualLanguageSize{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("GitRefUpdate_IndividualLanguageSize: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 4)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Lang (string) (string)
		case "lang":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Lang = string(sval)
			}
			// t.Size (int64) (int64)
		case "size":
			{
				maj, extra, err := cr.ReadHeader()
				if err != nil {
					return err
				}
				var extraI int64
				switch maj {
				case cbg.MajUnsignedInt:
					extraI = int64(extra)
					if extraI < 0 {
						return fmt.Errorf("int64 positive overflow")
					}
				case cbg.MajNegativeInt:
					extraI = int64(extra)
					if extraI < 0 {
						return fmt.Errorf("int64 negative overflow")
					}
					extraI = -1 - extraI
				default:
					return fmt.Errorf("wrong type for int64 field: %d", maj)
				}

				t.Size = int64(extraI)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *GitRefUpdate_LangBreakdown) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 1

	if t.Inputs == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Inputs ([]*tangled.GitRefUpdate_IndividualLanguageSize) (slice)
	if t.Inputs != nil {

		if len("inputs") > 1000000 {
			return xerrors.Errorf("Value in field \"inputs\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("inputs"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("inputs")); err != nil {
			return err
		}

		if len(t.Inputs) > 8192 {
			return xerrors.Errorf("Slice value in field t.Inputs was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Inputs))); err != nil {
			return err
		}
		for _, v := range t.Inputs {
			if err := v.MarshalCBOR(cw); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *GitRefUpdate_LangBreakdown) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GitRefUpdate_LangBreakdown{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("GitRefUpdate_LangBreakdown: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Inputs ([]*tangled.GitRefUpdate_IndividualLanguageSize) (slice)
		case "inputs":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Inputs: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Inputs = make([]*GitRefUpdate_IndividualLanguageSize, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{

						b, err := cr.ReadByte()
						if err != nil {
							return err
						}
						if b != cbg.CborNull[0] {
							if err := cr.UnreadByte(); err != nil {
								return err
							}
							t.Inputs[i] = new(GitRefUpdate_IndividualLanguageSize)
							if err := t.Inputs[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Inputs[i] pointer: %w", err)
							}
						}

					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *GitRefUpdate_Meta) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 3

	if t.LangBreakdown == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.CommitCount (tangled.GitRefUpdate_CommitCountBreakdown) (struct)
	if len("commitCount") > 1000000 {
		return xerrors.Errorf("Value in field \"commitCount\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commitCount"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("commitCount")); err != nil {
		return err
	}

	if err := t.CommitCount.MarshalCBOR(cw); err != nil {
		return err
	}

	// t.IsDefaultRef (bool) (bool)
	if len("isDefaultRef") > 1000000 {
		return xerrors.Errorf("Value in field \"isDefaultRef\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("isDefaultRef"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("isDefaultRef")); err != nil {
		return err
	}

	if err := cbg.WriteBool(w, t.IsDefaultRef); err != nil {
		return err
	}

	// t.LangBreakdown (tangled.GitRefUpdate_LangBreakdown) (struct)
	if t.LangBreakdown != nil {

		if len("langBreakdown") > 1000000 {
			return xerrors.Errorf("Value in field \"langBreakdown\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("langBreakdown"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("langBreakdown")); err != nil {
			return err
		}

		if err := t.LangBreakdown.MarshalCBOR(cw); err != nil {
			return err
		}
	}
	return nil
}

func (t *GitRefUpdate_Meta) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GitRefUpdate_Meta{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("GitRefUpdate_Meta: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 13)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.CommitCount (tangled.GitRefUpdate_CommitCountBreakdown) (struct)
		case "commitCount":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.CommitCount = new(GitRefUpdate_CommitCountBreakdown)
					if err := t.CommitCount.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.CommitCount pointer: %w", err)
					}
				}

			}
			// t.IsDefaultRef (bool) (bool)
		case "isDefaultRef":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}
			if maj != cbg.MajOther {
				return fmt.Errorf("booleans must be major type 7")
			}
			switch extra {
			case 20:
				t.IsDefaultRef = false
			case 21:
				t.IsDefaultRef = true
			default:
				return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
			}
			// t.LangBreakdown (tangled.GitRefUpdate_LangBreakdown) (struct)
		case "langBreakdown":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.LangBreakdown = new(GitRefUpdate_LangBreakdown)
					if err := t.LangBreakdown.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.LangBreakdown pointer: %w", err)
					}
				}

			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *GraphFollow) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{163}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.graph.follow"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.graph.follow")); err != nil {
		return err
	}

	// t.Subject (string) (string)
	if len("subject") > 1000000 {
		return xerrors.Errorf("Value in field \"subject\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("subject")); err != nil {
		return err
	}

	if len(t.Subject) > 1000000 {
		return xerrors.Errorf("Value in field t.Subject was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Subject)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *GraphFollow) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GraphFollow{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("GraphFollow: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Subject (string) (string)
		case "subject":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Subject = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Knot) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{162}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.knot"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.knot")); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *Knot) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Knot{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Knot: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *KnotMember) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.knot.member"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.knot.member")); err != nil {
		return err
	}

	// t.Domain (string) (string)
	if len("domain") > 1000000 {
		return xerrors.Errorf("Value in field \"domain\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("domain"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("domain")); err != nil {
		return err
	}

	if len(t.Domain) > 1000000 {
		return xerrors.Errorf("Value in field t.Domain was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Domain))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Domain)); err != nil {
		return err
	}

	// t.Subject (string) (string)
	if len("subject") > 1000000 {
		return xerrors.Errorf("Value in field \"subject\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("subject")); err != nil {
		return err
	}

	if len(t.Subject) > 1000000 {
		return xerrors.Errorf("Value in field t.Subject was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Subject)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *KnotMember) UnmarshalCBOR(r io.Reader) (err error) {
	*t = KnotMember{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("KnotMember: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Domain (string) (string)
		case "domain":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Domain = string(sval)
			}
			// t.Subject (string) (string)
		case "subject":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Subject = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *LabelDefinition) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 7

	if t.Color == nil {
		fieldCount--
	}

	if t.Multiple == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Name (string) (string)
	if len("name") > 1000000 {
		return xerrors.Errorf("Value in field \"name\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("name")); err != nil {
		return err
	}

	if len(t.Name) > 1000000 {
		return xerrors.Errorf("Value in field t.Name was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Name)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.label.definition"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.label.definition")); err != nil {
		return err
	}

	// t.Color (string) (string)
	if t.Color != nil {

		if len("color") > 1000000 {
			return xerrors.Errorf("Value in field \"color\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("color"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("color")); err != nil {
			return err
		}

		if t.Color == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Color) > 1000000 {
				return xerrors.Errorf("Value in field t.Color was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Color))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Color)); err != nil {
				return err
			}
		}
	}

	// t.Scope ([]string) (slice)
	if len("scope") > 1000000 {
		return xerrors.Errorf("Value in field \"scope\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("scope"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("scope")); err != nil {
		return err
	}

	if len(t.Scope) > 8192 {
		return xerrors.Errorf("Slice value in field t.Scope was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Scope))); err != nil {
		return err
	}
	for _, v := range t.Scope {
		if len(v) > 1000000 {
			return xerrors.Errorf("Value in field v was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string(v)); err != nil {
			return err
		}

	}

	// t.Multiple (bool) (bool)
	if t.Multiple != nil {

		if len("multiple") > 1000000 {
			return xerrors.Errorf("Value in field \"multiple\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("multiple"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("multiple")); err != nil {
			return err
		}

		if t.Multiple == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if err := cbg.WriteBool(w, *t.Multiple); err != nil {
				return err
			}
		}
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}

	// t.ValueType (tangled.LabelDefinition_ValueType) (struct)
	if len("valueType") > 1000000 {
		return xerrors.Errorf("Value in field \"valueType\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("valueType"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("valueType")); err != nil {
		return err
	}

	if err := t.ValueType.MarshalCBOR(cw); err != nil {
		return err
	}
	return nil
}

func (t *LabelDefinition) UnmarshalCBOR(r io.Reader) (err error) {
	*t = LabelDefinition{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("LabelDefinition: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Name (string) (string)
		case "name":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Name = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Color (string) (string)
		case "color":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Color = (*string)(&sval)
				}
			}
			// t.Scope ([]string) (slice)
		case "scope":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Scope: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Scope = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Scope[i] = string(sval)
					}

				}
			}
			// t.Multiple (bool) (bool)
		case "multiple":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					maj, extra, err = cr.ReadHeader()
					if err != nil {
						return err
					}
					if maj != cbg.MajOther {
						return fmt.Errorf("booleans must be major type 7")
					}

					var val bool
					switch extra {
					case 20:
						val = false
					case 21:
						val = true
					default:
						return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
					}
					t.Multiple = &val
				}
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}
			// t.ValueType (tangled.LabelDefinition_ValueType) (struct)
		case "valueType":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.ValueType = new(LabelDefinition_ValueType)
					if err := t.ValueType.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.ValueType pointer: %w", err)
					}
				}

			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *LabelDefinition_ValueType) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 3

	if t.Enum == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Enum ([]string) (slice)
	if t.Enum != nil {

		if len("enum") > 1000000 {
			return xerrors.Errorf("Value in field \"enum\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("enum"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("enum")); err != nil {
			return err
		}

		if len(t.Enum) > 8192 {
			return xerrors.Errorf("Slice value in field t.Enum was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Enum))); err != nil {
			return err
		}
		for _, v := range t.Enum {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.Type (string) (string)
	if len("type") > 1000000 {
		return xerrors.Errorf("Value in field \"type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("type")); err != nil {
		return err
	}

	if len(t.Type) > 1000000 {
		return xerrors.Errorf("Value in field t.Type was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Type))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Type)); err != nil {
		return err
	}

	// t.Format (string) (string)
	if len("format") > 1000000 {
		return xerrors.Errorf("Value in field \"format\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("format"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("format")); err != nil {
		return err
	}

	if len(t.Format) > 1000000 {
		return xerrors.Errorf("Value in field t.Format was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Format))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Format)); err != nil {
		return err
	}
	return nil
}

func (t *LabelDefinition_ValueType) UnmarshalCBOR(r io.Reader) (err error) {
	*t = LabelDefinition_ValueType{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("LabelDefinition_ValueType: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Enum ([]string) (slice)
		case "enum":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Enum: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Enum = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Enum[i] = string(sval)
					}

				}
			}
			// t.Type (string) (string)
		case "type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Type = string(sval)
			}
			// t.Format (string) (string)
		case "format":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Format = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *LabelOp) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{165}); err != nil {
		return err
	}

	// t.Add ([]*tangled.LabelOp_Operand) (slice)
	if len("add") > 1000000 {
		return xerrors.Errorf("Value in field \"add\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("add"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("add")); err != nil {
		return err
	}

	if len(t.Add) > 8192 {
		return xerrors.Errorf("Slice value in field t.Add was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Add))); err != nil {
		return err
	}
	for _, v := range t.Add {
		if err := v.MarshalCBOR(cw); err != nil {
			return err
		}

	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.label.op"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.label.op")); err != nil {
		return err
	}

	// t.Delete ([]*tangled.LabelOp_Operand) (slice)
	if len("delete") > 1000000 {
		return xerrors.Errorf("Value in field \"delete\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("delete"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("delete")); err != nil {
		return err
	}

	if len(t.Delete) > 8192 {
		return xerrors.Errorf("Slice value in field t.Delete was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Delete))); err != nil {
		return err
	}
	for _, v := range t.Delete {
		if err := v.MarshalCBOR(cw); err != nil {
			return err
		}

	}

	// t.Subject (string) (string)
	if len("subject") > 1000000 {
		return xerrors.Errorf("Value in field \"subject\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("subject")); err != nil {
		return err
	}

	if len(t.Subject) > 1000000 {
		return xerrors.Errorf("Value in field t.Subject was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Subject)); err != nil {
		return err
	}

	// t.PerformedAt (string) (string)
	if len("performedAt") > 1000000 {
		return xerrors.Errorf("Value in field \"performedAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("performedAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("performedAt")); err != nil {
		return err
	}

	if len(t.PerformedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.PerformedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.PerformedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.PerformedAt)); err != nil {
		return err
	}
	return nil
}

func (t *LabelOp) UnmarshalCBOR(r io.Reader) (err error) {
	*t = LabelOp{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("LabelOp: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 11)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Add ([]*tangled.LabelOp_Operand) (slice)
		case "add":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Add: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Add = make([]*LabelOp_Operand, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{

						b, err := cr.ReadByte()
						if err != nil {
							return err
						}
						if b != cbg.CborNull[0] {
							if err := cr.UnreadByte(); err != nil {
								return err
							}
							t.Add[i] = new(LabelOp_Operand)
							if err := t.Add[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Add[i] pointer: %w", err)
							}
						}

					}

				}
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Delete ([]*tangled.LabelOp_Operand) (slice)
		case "delete":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Delete: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Delete = make([]*LabelOp_Operand, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{

						b, err := cr.ReadByte()
						if err != nil {
							return err
						}
						if b != cbg.CborNull[0] {
							if err := cr.UnreadByte(); err != nil {
								return err
							}
							t.Delete[i] = new(LabelOp_Operand)
							if err := t.Delete[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Delete[i] pointer: %w", err)
							}
						}

					}

				}
			}
			// t.Subject (string) (string)
		case "subject":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Subject = string(sval)
			}
			// t.PerformedAt (string) (string)
		case "performedAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.PerformedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *LabelOp_Operand) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{162}); err != nil {
		return err
	}

	// t.Key (string) (string)
	if len("key") > 1000000 {
		return xerrors.Errorf("Value in field \"key\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("key")); err != nil {
		return err
	}

	if len(t.Key) > 1000000 {
		return xerrors.Errorf("Value in field t.Key was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Key)); err != nil {
		return err
	}

	// t.Value (string) (string)
	if len("value") > 1000000 {
		return xerrors.Errorf("Value in field \"value\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("value")); err != nil {
		return err
	}

	if len(t.Value) > 1000000 {
		return xerrors.Errorf("Value in field t.Value was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Value)); err != nil {
		return err
	}
	return nil
}

func (t *LabelOp_Operand) UnmarshalCBOR(r io.Reader) (err error) {
	*t = LabelOp_Operand{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("LabelOp_Operand: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 5)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Key (string) (string)
		case "key":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Key = string(sval)
			}
			// t.Value (string) (string)
		case "value":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Value = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{163}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.pipeline"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.pipeline")); err != nil {
		return err
	}

	// t.Workflows ([]*tangled.Pipeline_Workflow) (slice)
	if len("workflows") > 1000000 {
		return xerrors.Errorf("Value in field \"workflows\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflows"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("workflows")); err != nil {
		return err
	}

	if len(t.Workflows) > 8192 {
		return xerrors.Errorf("Slice value in field t.Workflows was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Workflows))); err != nil {
		return err
	}
	for _, v := range t.Workflows {
		if err := v.MarshalCBOR(cw); err != nil {
			return err
		}

	}

	// t.TriggerMetadata (tangled.Pipeline_TriggerMetadata) (struct)
	if len("triggerMetadata") > 1000000 {
		return xerrors.Errorf("Value in field \"triggerMetadata\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("triggerMetadata"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("triggerMetadata")); err != nil {
		return err
	}

	if err := t.TriggerMetadata.MarshalCBOR(cw); err != nil {
		return err
	}
	return nil
}

func (t *Pipeline) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 15)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Workflows ([]*tangled.Pipeline_Workflow) (slice)
		case "workflows":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Workflows: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Workflows = make([]*Pipeline_Workflow, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{

						b, err := cr.ReadByte()
						if err != nil {
							return err
						}
						if b != cbg.CborNull[0] {
							if err := cr.UnreadByte(); err != nil {
								return err
							}
							t.Workflows[i] = new(Pipeline_Workflow)
							if err := t.Workflows[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Workflows[i] pointer: %w", err)
							}
						}

					}

				}
			}
			// t.TriggerMetadata (tangled.Pipeline_TriggerMetadata) (struct)
		case "triggerMetadata":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.TriggerMetadata = new(Pipeline_TriggerMetadata)
					if err := t.TriggerMetadata.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.TriggerMetadata pointer: %w", err)
					}
				}

			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_CloneOpts) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{163}); err != nil {
		return err
	}

	// t.Skip (bool) (bool)
	if len("skip") > 1000000 {
		return xerrors.Errorf("Value in field \"skip\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("skip"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("skip")); err != nil {
		return err
	}

	if err := cbg.WriteBool(w, t.Skip); err != nil {
		return err
	}

	// t.Depth (int64) (int64)
	if len("depth") > 1000000 {
		return xerrors.Errorf("Value in field \"depth\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("depth"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("depth")); err != nil {
		return err
	}

	if t.Depth >= 0 {
		if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Depth)); err != nil {
			return err
		}
	} else {
		if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Depth-1)); err != nil {
			return err
		}
	}

	// t.Submodules (bool) (bool)
	if len("submodules") > 1000000 {
		return xerrors.Errorf("Value in field \"submodules\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("submodules"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("submodules")); err != nil {
		return err
	}

	if err := cbg.WriteBool(w, t.Submodules); err != nil {
		return err
	}
	return nil
}

func (t *Pipeline_CloneOpts) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_CloneOpts{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_CloneOpts: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 10)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Skip (bool) (bool)
		case "skip":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}
			if maj != cbg.MajOther {
				return fmt.Errorf("booleans must be major type 7")
			}
			switch extra {
			case 20:
				t.Skip = false
			case 21:
				t.Skip = true
			default:
				return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
			}
			// t.Depth (int64) (int64)
		case "depth":
			{
				maj, extra, err := cr.ReadHeader()
				if err != nil {
					return err
				}
				var extraI int64
				switch maj {
				case cbg.MajUnsignedInt:
					extraI = int64(extra)
					if extraI < 0 {
						return fmt.Errorf("int64 positive overflow")
					}
				case cbg.MajNegativeInt:
					extraI = int64(extra)
					if extraI < 0 {
						return fmt.Errorf("int64 negative overflow")
					}
					extraI = -1 - extraI
				default:
					return fmt.Errorf("wrong type for int64 field: %d", maj)
				}

				t.Depth = int64(extraI)
			}
			// t.Submodules (bool) (bool)
		case "submodules":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}
			if maj != cbg.MajOther {
				return fmt.Errorf("booleans must be major type 7")
			}
			switch extra {
			case 20:
				t.Submodules = false
			case 21:
				t.Submodules = true
			default:
				return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_ManualTriggerData) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 1

	if t.Inputs == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Inputs ([]*tangled.Pipeline_Pair) (slice)
	if t.Inputs != nil {

		if len("inputs") > 1000000 {
			return xerrors.Errorf("Value in field \"inputs\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("inputs"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("inputs")); err != nil {
			return err
		}

		if len(t.Inputs) > 8192 {
			return xerrors.Errorf("Slice value in field t.Inputs was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Inputs))); err != nil {
			return err
		}
		for _, v := range t.Inputs {
			if err := v.MarshalCBOR(cw); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *Pipeline_ManualTriggerData) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_ManualTriggerData{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_ManualTriggerData: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Inputs ([]*tangled.Pipeline_Pair) (slice)
		case "inputs":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Inputs: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Inputs = make([]*Pipeline_Pair, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{

						b, err := cr.ReadByte()
						if err != nil {
							return err
						}
						if b != cbg.CborNull[0] {
							if err := cr.UnreadByte(); err != nil {
								return err
							}
							t.Inputs[i] = new(Pipeline_Pair)
							if err := t.Inputs[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Inputs[i] pointer: %w", err)
							}
						}

					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_Pair) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{162}); err != nil {
		return err
	}

	// t.Key (string) (string)
	if len("key") > 1000000 {
		return xerrors.Errorf("Value in field \"key\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("key")); err != nil {
		return err
	}

	if len(t.Key) > 1000000 {
		return xerrors.Errorf("Value in field t.Key was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Key)); err != nil {
		return err
	}

	// t.Value (string) (string)
	if len("value") > 1000000 {
		return xerrors.Errorf("Value in field \"value\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("value"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("value")); err != nil {
		return err
	}

	if len(t.Value) > 1000000 {
		return xerrors.Errorf("Value in field t.Value was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Value))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Value)); err != nil {
		return err
	}
	return nil
}

func (t *Pipeline_Pair) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_Pair{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_Pair: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 5)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Key (string) (string)
		case "key":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Key = string(sval)
			}
			// t.Value (string) (string)
		case "value":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Value = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_PullRequestTriggerData) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.Action (string) (string)
	if len("action") > 1000000 {
		return xerrors.Errorf("Value in field \"action\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("action"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("action")); err != nil {
		return err
	}

	if len(t.Action) > 1000000 {
		return xerrors.Errorf("Value in field t.Action was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Action))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Action)); err != nil {
		return err
	}

	// t.SourceSha (string) (string)
	if len("sourceSha") > 1000000 {
		return xerrors.Errorf("Value in field \"sourceSha\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sourceSha"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sourceSha")); err != nil {
		return err
	}

	if len(t.SourceSha) > 1000000 {
		return xerrors.Errorf("Value in field t.SourceSha was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.SourceSha))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.SourceSha)); err != nil {
		return err
	}

	// t.SourceBranch (string) (string)
	if len("sourceBranch") > 1000000 {
		return xerrors.Errorf("Value in field \"sourceBranch\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sourceBranch"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sourceBranch")); err != nil {
		return err
	}

	if len(t.SourceBranch) > 1000000 {
		return xerrors.Errorf("Value in field t.SourceBranch was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.SourceBranch))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.SourceBranch)); err != nil {
		return err
	}

	// t.TargetBranch (string) (string)
	if len("targetBranch") > 1000000 {
		return xerrors.Errorf("Value in field \"targetBranch\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("targetBranch"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("targetBranch")); err != nil {
		return err
	}

	if len(t.TargetBranch) > 1000000 {
		return xerrors.Errorf("Value in field t.TargetBranch was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.TargetBranch))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.TargetBranch)); err != nil {
		return err
	}
	return nil
}

func (t *Pipeline_PullRequestTriggerData) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_PullRequestTriggerData{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_PullRequestTriggerData: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 12)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Action (string) (string)
		case "action":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Action = string(sval)
			}
			// t.SourceSha (string) (string)
		case "sourceSha":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.SourceSha = string(sval)
			}
			// t.SourceBranch (string) (string)
		case "sourceBranch":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.SourceBranch = string(sval)
			}
			// t.TargetBranch (string) (string)
		case "targetBranch":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.TargetBranch = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_PushTriggerData) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{163}); err != nil {
		return err
	}

	// t.Ref (string) (string)
	if len("ref") > 1000000 {
		return xerrors.Errorf("Value in field \"ref\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("ref")); err != nil {
		return err
	}

	if len(t.Ref) > 1000000 {
		return xerrors.Errorf("Value in field t.Ref was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Ref)); err != nil {
		return err
	}

	// t.NewSha (string) (string)
	if len("newSha") > 1000000 {
		return xerrors.Errorf("Value in field \"newSha\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("newSha")); err != nil {
		return err
	}

	if len(t.NewSha) > 1000000 {
		return xerrors.Errorf("Value in field t.NewSha was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.NewSha)); err != nil {
		return err
	}

	// t.OldSha (string) (string)
	if len("oldSha") > 1000000 {
		return xerrors.Errorf("Value in field \"oldSha\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("oldSha")); err != nil {
		return err
	}

	if len(t.OldSha) > 1000000 {
		return xerrors.Errorf("Value in field t.OldSha was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.OldSha)); err != nil {
		return err
	}
	return nil
}

func (t *Pipeline_PushTriggerData) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_PushTriggerData{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_PushTriggerData: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Ref (string) (string)
		case "ref":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Ref = string(sval)
			}
			// t.NewSha (string) (string)
		case "newSha":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.NewSha = string(sval)
			}
			// t.OldSha (string) (string)
		case "oldSha":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.OldSha = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *PipelineStatus) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 7

	if t.Error == nil {
		fieldCount--
	}

	if t.ExitCode == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.pipeline.status"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.pipeline.status")); err != nil {
		return err
	}

	// t.Error (string) (string)
	if t.Error != nil {

		if len("error") > 1000000 {
			return xerrors.Errorf("Value in field \"error\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("error"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("error")); err != nil {
			return err
		}

		if t.Error == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Error) > 1000000 {
				return xerrors.Errorf("Value in field t.Error was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Error))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Error)); err != nil {
				return err
			}
		}
	}

	// t.Status (string) (string)
	if len("status") > 1000000 {
		return xerrors.Errorf("Value in field \"status\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("status")); err != nil {
		return err
	}

	if len(t.Status) > 1000000 {
		return xerrors.Errorf("Value in field t.Status was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Status)); err != nil {
		return err
	}

	// t.ExitCode (int64) (int64)
	if t.ExitCode != nil {

		if len("exitCode") > 1000000 {
			return xerrors.Errorf("Value in field \"exitCode\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("exitCode"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("exitCode")); err != nil {
			return err
		}

		if t.ExitCode == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if *t.ExitCode >= 0 {
				if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.ExitCode)); err != nil {
					return err
				}
			} else {
				if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.ExitCode-1)); err != nil {
					return err
				}
			}
		}

	}

	// t.Pipeline (string) (string)
	if len("pipeline") > 1000000 {
		return xerrors.Errorf("Value in field \"pipeline\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pipeline"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("pipeline")); err != nil {
		return err
	}

	if len(t.Pipeline) > 1000000 {
		return xerrors.Errorf("Value in field t.Pipeline was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pipeline))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Pipeline)); err != nil {
		return err
	}

	// t.Workflow (string) (string)
	if len("workflow") > 1000000 {
		return xerrors.Errorf("Value in field \"workflow\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflow"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("workflow")); err != nil {
		return err
	}

	if len(t.Workflow) > 1000000 {
		return xerrors.Errorf("Value in field t.Workflow was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Workflow))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Workflow)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *PipelineStatus) UnmarshalCBOR(r io.Reader) (err error) {
	*t = PipelineStatus{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("PipelineStatus: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Error (string) (string)
		case "error":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Error = (*string)(&sval)
				}
			}
			// t.Status (string) (string)
		case "status":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Status = string(sval)
			}
			// t.ExitCode (int64) (int64)
		case "exitCode":
			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					maj, extra, err := cr.ReadHeader()
					if err != nil {
						return err
					}
					var extraI int64
					switch maj {
					case cbg.MajUnsignedInt:
						extraI = int64(extra)
						if extraI < 0 {
							return fmt.Errorf("int64 positive overflow")
						}
					case cbg.MajNegativeInt:
						extraI = int64(extra)
						if extraI < 0 {
							return fmt.Errorf("int64 negative overflow")
						}
						extraI = -1 - extraI
					default:
						return fmt.Errorf("wrong type for int64 field: %d", maj)
					}

					t.ExitCode = (*int64)(&extraI)
				}
			}
			// t.Pipeline (string) (string)
		case "pipeline":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Pipeline = string(sval)
			}
			// t.Workflow (string) (string)
		case "workflow":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Workflow = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_TriggerMetadata) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 5

	if t.Manual == nil {
		fieldCount--
	}

	if t.PullRequest == nil {
		fieldCount--
	}

	if t.Push == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Kind (string) (string)
	if len("kind") > 1000000 {
		return xerrors.Errorf("Value in field \"kind\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("kind"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("kind")); err != nil {
		return err
	}

	if len(t.Kind) > 1000000 {
		return xerrors.Errorf("Value in field t.Kind was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Kind))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Kind)); err != nil {
		return err
	}

	// t.Push (tangled.Pipeline_PushTriggerData) (struct)
	if t.Push != nil {

		if len("push") > 1000000 {
			return xerrors.Errorf("Value in field \"push\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("push"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("push")); err != nil {
			return err
		}

		if err := t.Push.MarshalCBOR(cw); err != nil {
			return err
		}
	}

	// t.Repo (tangled.Pipeline_TriggerRepo) (struct)
	if len("repo") > 1000000 {
		return xerrors.Errorf("Value in field \"repo\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repo")); err != nil {
		return err
	}

	if err := t.Repo.MarshalCBOR(cw); err != nil {
		return err
	}

	// t.Manual (tangled.Pipeline_ManualTriggerData) (struct)
	if t.Manual != nil {

		if len("manual") > 1000000 {
			return xerrors.Errorf("Value in field \"manual\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("manual"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("manual")); err != nil {
			return err
		}

		if err := t.Manual.MarshalCBOR(cw); err != nil {
			return err
		}
	}

	// t.PullRequest (tangled.Pipeline_PullRequestTriggerData) (struct)
	if t.PullRequest != nil {

		if len("pullRequest") > 1000000 {
			return xerrors.Errorf("Value in field \"pullRequest\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullRequest"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("pullRequest")); err != nil {
			return err
		}

		if err := t.PullRequest.MarshalCBOR(cw); err != nil {
			return err
		}
	}
	return nil
}

func (t *Pipeline_TriggerMetadata) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_TriggerMetadata{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_TriggerMetadata: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 11)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Kind (string) (string)
		case "kind":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Kind = string(sval)
			}
			// t.Push (tangled.Pipeline_PushTriggerData) (struct)
		case "push":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Push = new(Pipeline_PushTriggerData)
					if err := t.Push.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Push pointer: %w", err)
					}
				}

			}
			// t.Repo (tangled.Pipeline_TriggerRepo) (struct)
		case "repo":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Repo = new(Pipeline_TriggerRepo)
					if err := t.Repo.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Repo pointer: %w", err)
					}
				}

			}
			// t.Manual (tangled.Pipeline_ManualTriggerData) (struct)
		case "manual":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Manual = new(Pipeline_ManualTriggerData)
					if err := t.Manual.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Manual pointer: %w", err)
					}
				}

			}
			// t.PullRequest (tangled.Pipeline_PullRequestTriggerData) (struct)
		case "pullRequest":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.PullRequest = new(Pipeline_PullRequestTriggerData)
					if err := t.PullRequest.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.PullRequest pointer: %w", err)
					}
				}

			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_TriggerRepo) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.Did (string) (string)
	if len("did") > 1000000 {
		return xerrors.Errorf("Value in field \"did\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("did"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("did")); err != nil {
		return err
	}

	if len(t.Did) > 1000000 {
		return xerrors.Errorf("Value in field t.Did was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Did))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Did)); err != nil {
		return err
	}

	// t.Knot (string) (string)
	if len("knot") > 1000000 {
		return xerrors.Errorf("Value in field \"knot\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("knot"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("knot")); err != nil {
		return err
	}

	if len(t.Knot) > 1000000 {
		return xerrors.Errorf("Value in field t.Knot was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Knot))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Knot)); err != nil {
		return err
	}

	// t.Repo (string) (string)
	if len("repo") > 1000000 {
		return xerrors.Errorf("Value in field \"repo\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repo")); err != nil {
		return err
	}

	if len(t.Repo) > 1000000 {
		return xerrors.Errorf("Value in field t.Repo was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Repo)); err != nil {
		return err
	}

	// t.DefaultBranch (string) (string)
	if len("defaultBranch") > 1000000 {
		return xerrors.Errorf("Value in field \"defaultBranch\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("defaultBranch"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("defaultBranch")); err != nil {
		return err
	}

	if len(t.DefaultBranch) > 1000000 {
		return xerrors.Errorf("Value in field t.DefaultBranch was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.DefaultBranch))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.DefaultBranch)); err != nil {
		return err
	}
	return nil
}

func (t *Pipeline_TriggerRepo) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_TriggerRepo{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_TriggerRepo: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 13)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Did (string) (string)
		case "did":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Did = string(sval)
			}
			// t.Knot (string) (string)
		case "knot":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Knot = string(sval)
			}
			// t.Repo (string) (string)
		case "repo":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Repo = string(sval)
			}
			// t.DefaultBranch (string) (string)
		case "defaultBranch":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.DefaultBranch = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Pipeline_Workflow) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.Raw (string) (string)
	if len("raw") > 1000000 {
		return xerrors.Errorf("Value in field \"raw\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("raw"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("raw")); err != nil {
		return err
	}

	if len(t.Raw) > 1000000 {
		return xerrors.Errorf("Value in field t.Raw was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Raw))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Raw)); err != nil {
		return err
	}

	// t.Name (string) (string)
	if len("name") > 1000000 {
		return xerrors.Errorf("Value in field \"name\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("name")); err != nil {
		return err
	}

	if len(t.Name) > 1000000 {
		return xerrors.Errorf("Value in field t.Name was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Name)); err != nil {
		return err
	}

	// t.Clone (tangled.Pipeline_CloneOpts) (struct)
	if len("clone") > 1000000 {
		return xerrors.Errorf("Value in field \"clone\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("clone"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("clone")); err != nil {
		return err
	}

	if err := t.Clone.MarshalCBOR(cw); err != nil {
		return err
	}

	// t.Engine (string) (string)
	if len("engine") > 1000000 {
		return xerrors.Errorf("Value in field \"engine\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("engine"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("engine")); err != nil {
		return err
	}

	if len(t.Engine) > 1000000 {
		return xerrors.Errorf("Value in field t.Engine was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Engine))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Engine)); err != nil {
		return err
	}
	return nil
}

func (t *Pipeline_Workflow) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Pipeline_Workflow{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Pipeline_Workflow: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Raw (string) (string)
		case "raw":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Raw = string(sval)
			}
			// t.Name (string) (string)
		case "name":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Name = string(sval)
			}
			// t.Clone (tangled.Pipeline_CloneOpts) (struct)
		case "clone":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Clone = new(Pipeline_CloneOpts)
					if err := t.Clone.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Clone pointer: %w", err)
					}
				}

			}
			// t.Engine (string) (string)
		case "engine":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Engine = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *PublicKey) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.Key (string) (string)
	if len("key") > 1000000 {
		return xerrors.Errorf("Value in field \"key\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("key")); err != nil {
		return err
	}

	if len(t.Key) > 1000000 {
		return xerrors.Errorf("Value in field t.Key was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Key)); err != nil {
		return err
	}

	// t.Name (string) (string)
	if len("name") > 1000000 {
		return xerrors.Errorf("Value in field \"name\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("name")); err != nil {
		return err
	}

	if len(t.Name) > 1000000 {
		return xerrors.Errorf("Value in field t.Name was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Name)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.publicKey"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.publicKey")); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *PublicKey) UnmarshalCBOR(r io.Reader) (err error) {
	*t = PublicKey{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("PublicKey: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Key (string) (string)
		case "key":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Key = string(sval)
			}
			// t.Name (string) (string)
		case "name":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Name = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Repo) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 10

	if t.Description == nil {
		fieldCount--
	}

	if t.Labels == nil {
		fieldCount--
	}

	if t.Source == nil {
		fieldCount--
	}

	if t.Spindle == nil {
		fieldCount--
	}

	if t.Topics == nil {
		fieldCount--
	}

	if t.Website == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Knot (string) (string)
	if len("knot") > 1000000 {
		return xerrors.Errorf("Value in field \"knot\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("knot"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("knot")); err != nil {
		return err
	}

	if len(t.Knot) > 1000000 {
		return xerrors.Errorf("Value in field t.Knot was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Knot))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Knot)); err != nil {
		return err
	}

	// t.Name (string) (string)
	if len("name") > 1000000 {
		return xerrors.Errorf("Value in field \"name\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("name")); err != nil {
		return err
	}

	if len(t.Name) > 1000000 {
		return xerrors.Errorf("Value in field t.Name was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Name)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo")); err != nil {
		return err
	}

	// t.Labels ([]string) (slice)
	if t.Labels != nil {

		if len("labels") > 1000000 {
			return xerrors.Errorf("Value in field \"labels\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("labels"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("labels")); err != nil {
			return err
		}

		if len(t.Labels) > 8192 {
			return xerrors.Errorf("Slice value in field t.Labels was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Labels))); err != nil {
			return err
		}
		for _, v := range t.Labels {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.Source (string) (string)
	if t.Source != nil {

		if len("source") > 1000000 {
			return xerrors.Errorf("Value in field \"source\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("source")); err != nil {
			return err
		}

		if t.Source == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Source) > 1000000 {
				return xerrors.Errorf("Value in field t.Source was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Source))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Source)); err != nil {
				return err
			}
		}
	}

	// t.Topics ([]string) (slice)
	if t.Topics != nil {

		if len("topics") > 1000000 {
			return xerrors.Errorf("Value in field \"topics\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("topics"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("topics")); err != nil {
			return err
		}

		if len(t.Topics) > 8192 {
			return xerrors.Errorf("Slice value in field t.Topics was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Topics))); err != nil {
			return err
		}
		for _, v := range t.Topics {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.Spindle (string) (string)
	if t.Spindle != nil {

		if len("spindle") > 1000000 {
			return xerrors.Errorf("Value in field \"spindle\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("spindle"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("spindle")); err != nil {
			return err
		}

		if t.Spindle == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Spindle) > 1000000 {
				return xerrors.Errorf("Value in field t.Spindle was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Spindle))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Spindle)); err != nil {
				return err
			}
		}
	}

	// t.Website (string) (string)
	if t.Website != nil {

		if len("website") > 1000000 {
			return xerrors.Errorf("Value in field \"website\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("website"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("website")); err != nil {
			return err
		}

		if t.Website == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Website) > 1000000 {
				return xerrors.Errorf("Value in field t.Website was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Website))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Website)); err != nil {
				return err
			}
		}
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}

	// t.Description (string) (string)
	if t.Description != nil {

		if len("description") > 1000000 {
			return xerrors.Errorf("Value in field \"description\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("description")); err != nil {
			return err
		}

		if t.Description == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Description) > 1000000 {
				return xerrors.Errorf("Value in field t.Description was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Description))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Description)); err != nil {
				return err
			}
		}
	}
	return nil
}

func (t *Repo) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Repo{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Repo: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 11)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Knot (string) (string)
		case "knot":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Knot = string(sval)
			}
			// t.Name (string) (string)
		case "name":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Name = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Labels ([]string) (slice)
		case "labels":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Labels: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Labels = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Labels[i] = string(sval)
					}

				}
			}
			// t.Source (string) (string)
		case "source":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Source = (*string)(&sval)
				}
			}
			// t.Topics ([]string) (slice)
		case "topics":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Topics: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Topics = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Topics[i] = string(sval)
					}

				}
			}
			// t.Spindle (string) (string)
		case "spindle":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Spindle = (*string)(&sval)
				}
			}
			// t.Website (string) (string)
		case "website":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Website = (*string)(&sval)
				}
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}
			// t.Description (string) (string)
		case "description":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Description = (*string)(&sval)
				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoArtifact) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 6

	if t.Tag == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Tag (util.LexBytes) (slice)
	if t.Tag != nil {

		if len("tag") > 1000000 {
			return xerrors.Errorf("Value in field \"tag\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("tag"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("tag")); err != nil {
			return err
		}

		if len(t.Tag) > 2097152 {
			return xerrors.Errorf("Byte array in field t.Tag was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Tag))); err != nil {
			return err
		}

		if _, err := cw.Write(t.Tag); err != nil {
			return err
		}

	}

	// t.Name (string) (string)
	if len("name") > 1000000 {
		return xerrors.Errorf("Value in field \"name\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("name")); err != nil {
		return err
	}

	if len(t.Name) > 1000000 {
		return xerrors.Errorf("Value in field t.Name was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Name)); err != nil {
		return err
	}

	// t.Repo (string) (string)
	if len("repo") > 1000000 {
		return xerrors.Errorf("Value in field \"repo\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repo")); err != nil {
		return err
	}

	if len(t.Repo) > 1000000 {
		return xerrors.Errorf("Value in field t.Repo was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Repo)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.artifact"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.artifact")); err != nil {
		return err
	}

	// t.Artifact (util.LexBlob) (struct)
	if len("artifact") > 1000000 {
		return xerrors.Errorf("Value in field \"artifact\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("artifact"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("artifact")); err != nil {
		return err
	}

	if err := t.Artifact.MarshalCBOR(cw); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *RepoArtifact) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoArtifact{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoArtifact: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Tag (util.LexBytes) (slice)
		case "tag":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 2097152 {
				return fmt.Errorf("t.Tag: byte array too large (%d)", extra)
			}
			if maj != cbg.MajByteString {
				return fmt.Errorf("expected byte array")
			}

			if extra > 0 {
				t.Tag = make([]uint8, extra)
			}

			if _, err := io.ReadFull(cr, t.Tag); err != nil {
				return err
			}

			// t.Name (string) (string)
		case "name":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Name = string(sval)
			}
			// t.Repo (string) (string)
		case "repo":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Repo = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Artifact (util.LexBlob) (struct)
		case "artifact":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Artifact = new(util.LexBlob)
					if err := t.Artifact.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Artifact pointer: %w", err)
					}
				}

			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoCollaborator) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.Repo (string) (string)
	if len("repo") > 1000000 {
		return xerrors.Errorf("Value in field \"repo\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repo")); err != nil {
		return err
	}

	if len(t.Repo) > 1000000 {
		return xerrors.Errorf("Value in field t.Repo was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Repo)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.collaborator"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.collaborator")); err != nil {
		return err
	}

	// t.Subject (string) (string)
	if len("subject") > 1000000 {
		return xerrors.Errorf("Value in field \"subject\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("subject")); err != nil {
		return err
	}

	if len(t.Subject) > 1000000 {
		return xerrors.Errorf("Value in field t.Subject was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Subject)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *RepoCollaborator) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoCollaborator{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoCollaborator: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Repo (string) (string)
		case "repo":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Repo = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Subject (string) (string)
		case "subject":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Subject = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoIssue) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 7

	if t.Body == nil {
		fieldCount--
	}

	if t.Mentions == nil {
		fieldCount--
	}

	if t.References == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Body (string) (string)
	if t.Body != nil {

		if len("body") > 1000000 {
			return xerrors.Errorf("Value in field \"body\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("body")); err != nil {
			return err
		}

		if t.Body == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Body) > 1000000 {
				return xerrors.Errorf("Value in field t.Body was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Body)); err != nil {
				return err
			}
		}
	}

	// t.Repo (string) (string)
	if len("repo") > 1000000 {
		return xerrors.Errorf("Value in field \"repo\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repo")); err != nil {
		return err
	}

	if len(t.Repo) > 1000000 {
		return xerrors.Errorf("Value in field t.Repo was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Repo)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.issue")); err != nil {
		return err
	}

	// t.Title (string) (string)
	if len("title") > 1000000 {
		return xerrors.Errorf("Value in field \"title\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("title")); err != nil {
		return err
	}

	if len(t.Title) > 1000000 {
		return xerrors.Errorf("Value in field t.Title was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Title)); err != nil {
		return err
	}

	// t.Mentions ([]string) (slice)
	if t.Mentions != nil {

		if len("mentions") > 1000000 {
			return xerrors.Errorf("Value in field \"mentions\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("mentions"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("mentions")); err != nil {
			return err
		}

		if len(t.Mentions) > 8192 {
			return xerrors.Errorf("Slice value in field t.Mentions was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Mentions))); err != nil {
			return err
		}
		for _, v := range t.Mentions {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}

	// t.References ([]string) (slice)
	if t.References != nil {

		if len("references") > 1000000 {
			return xerrors.Errorf("Value in field \"references\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("references"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("references")); err != nil {
			return err
		}

		if len(t.References) > 8192 {
			return xerrors.Errorf("Slice value in field t.References was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.References))); err != nil {
			return err
		}
		for _, v := range t.References {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *RepoIssue) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoIssue{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoIssue: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 10)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Body (string) (string)
		case "body":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Body = (*string)(&sval)
				}
			}
			// t.Repo (string) (string)
		case "repo":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Repo = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Title (string) (string)
		case "title":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Title = string(sval)
			}
			// t.Mentions ([]string) (slice)
		case "mentions":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Mentions: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Mentions = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Mentions[i] = string(sval)
					}

				}
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}
			// t.References ([]string) (slice)
		case "references":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.References: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.References = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.References[i] = string(sval)
					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 7

	if t.Mentions == nil {
		fieldCount--
	}

	if t.References == nil {
		fieldCount--
	}

	if t.ReplyTo == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Body (string) (string)
	if len("body") > 1000000 {
		return xerrors.Errorf("Value in field \"body\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("body")); err != nil {
		return err
	}

	if len(t.Body) > 1000000 {
		return xerrors.Errorf("Value in field t.Body was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Body)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.comment"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.issue.comment")); err != nil {
		return err
	}

	// t.Issue (string) (string)
	if len("issue") > 1000000 {
		return xerrors.Errorf("Value in field \"issue\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("issue")); err != nil {
		return err
	}

	if len(t.Issue) > 1000000 {
		return xerrors.Errorf("Value in field t.Issue was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Issue)); err != nil {
		return err
	}

	// t.ReplyTo (string) (string)
	if t.ReplyTo != nil {

		if len("replyTo") > 1000000 {
			return xerrors.Errorf("Value in field \"replyTo\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("replyTo"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("replyTo")); err != nil {
			return err
		}

		if t.ReplyTo == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.ReplyTo) > 1000000 {
				return xerrors.Errorf("Value in field t.ReplyTo was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.ReplyTo))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.ReplyTo)); err != nil {
				return err
			}
		}
	}

	// t.Mentions ([]string) (slice)
	if t.Mentions != nil {

		if len("mentions") > 1000000 {
			return xerrors.Errorf("Value in field \"mentions\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("mentions"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("mentions")); err != nil {
			return err
		}

		if len(t.Mentions) > 8192 {
			return xerrors.Errorf("Slice value in field t.Mentions was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Mentions))); err != nil {
			return err
		}
		for _, v := range t.Mentions {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}

	// t.References ([]string) (slice)
	if t.References != nil {

		if len("references") > 1000000 {
			return xerrors.Errorf("Value in field \"references\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("references"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("references")); err != nil {
			return err
		}

		if len(t.References) > 8192 {
			return xerrors.Errorf("Slice value in field t.References was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.References))); err != nil {
			return err
		}
		for _, v := range t.References {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoIssueComment{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoIssueComment: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 10)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Body (string) (string)
		case "body":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Body = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Issue (string) (string)
		case "issue":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Issue = string(sval)
			}
			// t.ReplyTo (string) (string)
		case "replyTo":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.ReplyTo = (*string)(&sval)
				}
			}
			// t.Mentions ([]string) (slice)
		case "mentions":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Mentions: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Mentions = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Mentions[i] = string(sval)
					}

				}
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}
			// t.References ([]string) (slice)
		case "references":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.References: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.References = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.References[i] = string(sval)
					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoIssueState) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{163}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.state"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.issue.state")); err != nil {
		return err
	}

	// t.Issue (string) (string)
	if len("issue") > 1000000 {
		return xerrors.Errorf("Value in field \"issue\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("issue")); err != nil {
		return err
	}

	if len(t.Issue) > 1000000 {
		return xerrors.Errorf("Value in field t.Issue was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Issue)); err != nil {
		return err
	}

	// t.State (string) (string)
	if len("state") > 1000000 {
		return xerrors.Errorf("Value in field \"state\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("state"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("state")); err != nil {
		return err
	}

	if len(t.State) > 1000000 {
		return xerrors.Errorf("Value in field t.State was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.State))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.State)); err != nil {
		return err
	}
	return nil
}

func (t *RepoIssueState) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoIssueState{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoIssueState: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 5)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Issue (string) (string)
		case "issue":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Issue = string(sval)
			}
			// t.State (string) (string)
		case "state":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.State = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoPull) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 10

	if t.Body == nil {
		fieldCount--
	}

	if t.Mentions == nil {
		fieldCount--
	}

	if t.Patch == nil {
		fieldCount--
	}

	if t.References == nil {
		fieldCount--
	}

	if t.Source == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Body (string) (string)
	if t.Body != nil {

		if len("body") > 1000000 {
			return xerrors.Errorf("Value in field \"body\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("body")); err != nil {
			return err
		}

		if t.Body == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Body) > 1000000 {
				return xerrors.Errorf("Value in field t.Body was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Body))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Body)); err != nil {
				return err
			}
		}
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.pull")); err != nil {
		return err
	}

	// t.Patch (string) (string)
	if t.Patch != nil {

		if len("patch") > 1000000 {
			return xerrors.Errorf("Value in field \"patch\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patch"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("patch")); err != nil {
			return err
		}

		if t.Patch == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Patch) > 1000000 {
				return xerrors.Errorf("Value in field t.Patch was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Patch))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Patch)); err != nil {
				return err
			}
		}
	}

	// t.Title (string) (string)
	if len("title") > 1000000 {
		return xerrors.Errorf("Value in field \"title\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("title"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("title")); err != nil {
		return err
	}

	if len(t.Title) > 1000000 {
		return xerrors.Errorf("Value in field t.Title was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Title))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Title)); err != nil {
		return err
	}

	// t.Source (tangled.RepoPull_Source) (struct)
	if t.Source != nil {

		if len("source") > 1000000 {
			return xerrors.Errorf("Value in field \"source\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("source"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("source")); err != nil {
			return err
		}

		if err := t.Source.MarshalCBOR(cw); err != nil {
			return err
		}
	}

	// t.Target (tangled.RepoPull_Target) (struct)
	if len("target") > 1000000 {
		return xerrors.Errorf("Value in field \"target\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("target"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("target")); err != nil {
		return err
	}

	if err := t.Target.MarshalCBOR(cw); err != nil {
		return err
	}

	// t.Mentions ([]string) (slice)
	if t.Mentions != nil {

		if len("mentions") > 1000000 {
			return xerrors.Errorf("Value in field \"mentions\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("mentions"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("mentions")); err != nil {
			return err
		}

		if len(t.Mentions) > 8192 {
			return xerrors.Errorf("Slice value in field t.Mentions was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Mentions))); err != nil {
			return err
		}
		for _, v := range t.Mentions {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}

	// t.PatchBlob (util.LexBlob) (struct)
	if len("patchBlob") > 1000000 {
		return xerrors.Errorf("Value in field \"patchBlob\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("patchBlob"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("patchBlob")); err != nil {
		return err
	}

	if err := t.PatchBlob.MarshalCBOR(cw); err != nil {
		return err
	}

	// t.References ([]string) (slice)
	if t.References != nil {

		if len("references") > 1000000 {
			return xerrors.Errorf("Value in field \"references\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("references"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("references")); err != nil {
			return err
		}

		if len(t.References) > 8192 {
			return xerrors.Errorf("Slice value in field t.References was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.References))); err != nil {
			return err
		}
		for _, v := range t.References {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *RepoPull) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoPull{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoPull: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 10)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Body (string) (string)
		case "body":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Body = (*string)(&sval)
				}
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Patch (string) (string)
		case "patch":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Patch = (*string)(&sval)
				}
			}
			// t.Title (string) (string)
		case "title":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Title = string(sval)
			}
			// t.Source (tangled.RepoPull_Source) (struct)
		case "source":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Source = new(RepoPull_Source)
					if err := t.Source.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Source pointer: %w", err)
					}
				}

			}
			// t.Target (tangled.RepoPull_Target) (struct)
		case "target":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Target = new(RepoPull_Target)
					if err := t.Target.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Target pointer: %w", err)
					}
				}

			}
			// t.Mentions ([]string) (slice)
		case "mentions":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Mentions: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Mentions = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Mentions[i] = string(sval)
					}

				}
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}
			// t.PatchBlob (util.LexBlob) (struct)
		case "patchBlob":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.PatchBlob = new(util.LexBlob)
					if err := t.PatchBlob.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.PatchBlob pointer: %w", err)
					}
				}

			}
			// t.References ([]string) (slice)
		case "references":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.References: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.References = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.References[i] = string(sval)
					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoPullComment) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 6

	if t.Mentions == nil {
		fieldCount--
	}

	if t.References == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Body (string) (string)
	if len("body") > 1000000 {
		return xerrors.Errorf("Value in field \"body\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("body")); err != nil {
		return err
	}

	if len(t.Body) > 1000000 {
		return xerrors.Errorf("Value in field t.Body was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Body)); err != nil {
		return err
	}

	// t.Pull (string) (string)
	if len("pull") > 1000000 {
		return xerrors.Errorf("Value in field \"pull\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("pull")); err != nil {
		return err
	}

	if len(t.Pull) > 1000000 {
		return xerrors.Errorf("Value in field t.Pull was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Pull)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.comment"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.pull.comment")); err != nil {
		return err
	}

	// t.Mentions ([]string) (slice)
	if t.Mentions != nil {

		if len("mentions") > 1000000 {
			return xerrors.Errorf("Value in field \"mentions\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("mentions"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("mentions")); err != nil {
			return err
		}

		if len(t.Mentions) > 8192 {
			return xerrors.Errorf("Slice value in field t.Mentions was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Mentions))); err != nil {
			return err
		}
		for _, v := range t.Mentions {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}

	// t.References ([]string) (slice)
	if t.References != nil {

		if len("references") > 1000000 {
			return xerrors.Errorf("Value in field \"references\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("references"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("references")); err != nil {
			return err
		}

		if len(t.References) > 8192 {
			return xerrors.Errorf("Slice value in field t.References was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.References))); err != nil {
			return err
		}
		for _, v := range t.References {
			if len(v) > 1000000 {
				return xerrors.Errorf("Value in field v was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(v)); err != nil {
				return err
			}

		}
	}
	return nil
}

func (t *RepoPullComment) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoPullComment{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoPullComment: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 10)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Body (string) (string)
		case "body":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Body = string(sval)
			}
			// t.Pull (string) (string)
		case "pull":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Pull = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Mentions ([]string) (slice)
		case "mentions":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.Mentions: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.Mentions = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.Mentions[i] = string(sval)
					}

				}
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}
			// t.References ([]string) (slice)
		case "references":

			maj, extra, err = cr.ReadHeader()
			if err != nil {
				return err
			}

			if extra > 8192 {
				return fmt.Errorf("t.References: array too large (%d)", extra)
			}

			if maj != cbg.MajArray {
				return fmt.Errorf("expected cbor array")
			}

			if extra > 0 {
				t.References = make([]string, extra)
			}

			for i := 0; i < int(extra); i++ {
				{
					var maj byte
					var extra uint64
					var err error
					_ = maj
					_ = extra
					_ = err

					{
						sval, err := cbg.ReadStringWithMax(cr, 1000000)
						if err != nil {
							return err
						}

						t.References[i] = string(sval)
					}

				}
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoPull_Source) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)
	fieldCount := 3

	if t.Repo == nil {
		fieldCount--
	}

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
		return err
	}

	// t.Sha (string) (string)
	if len("sha") > 1000000 {
		return xerrors.Errorf("Value in field \"sha\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sha"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sha")); err != nil {
		return err
	}

	if len(t.Sha) > 1000000 {
		return xerrors.Errorf("Value in field t.Sha was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Sha))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Sha)); err != nil {
		return err
	}

	// t.Repo (string) (string)
	if t.Repo != nil {

		if len("repo") > 1000000 {
			return xerrors.Errorf("Value in field \"repo\" was too long")
		}

		if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
			return err
		}
		if _, err := cw.WriteString(string("repo")); err != nil {
			return err
		}

		if t.Repo == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			if len(*t.Repo) > 1000000 {
				return xerrors.Errorf("Value in field t.Repo was too long")
			}

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Repo)); err != nil {
				return err
			}
		}
	}

	// t.Branch (string) (string)
	if len("branch") > 1000000 {
		return xerrors.Errorf("Value in field \"branch\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("branch")); err != nil {
		return err
	}

	if len(t.Branch) > 1000000 {
		return xerrors.Errorf("Value in field t.Branch was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Branch)); err != nil {
		return err
	}
	return nil
}

func (t *RepoPull_Source) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoPull_Source{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoPull_Source: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Sha (string) (string)
		case "sha":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Sha = string(sval)
			}
			// t.Repo (string) (string)
		case "repo":

			{
				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}

					sval, err := cbg.ReadStringWithMax(cr, 1000000)
					if err != nil {
						return err
					}

					t.Repo = (*string)(&sval)
				}
			}
			// t.Branch (string) (string)
		case "branch":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Branch = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoPullStatus) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{163}); err != nil {
		return err
	}

	// t.Pull (string) (string)
	if len("pull") > 1000000 {
		return xerrors.Errorf("Value in field \"pull\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("pull")); err != nil {
		return err
	}

	if len(t.Pull) > 1000000 {
		return xerrors.Errorf("Value in field t.Pull was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Pull)); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.status"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.repo.pull.status")); err != nil {
		return err
	}

	// t.Status (string) (string)
	if len("status") > 1000000 {
		return xerrors.Errorf("Value in field \"status\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("status")); err != nil {
		return err
	}

	if len(t.Status) > 1000000 {
		return xerrors.Errorf("Value in field t.Status was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Status)); err != nil {
		return err
	}
	return nil
}

func (t *RepoPullStatus) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoPullStatus{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoPullStatus: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Pull (string) (string)
		case "pull":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Pull = string(sval)
			}
			// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Status (string) (string)
		case "status":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Status = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *RepoPull_Target) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{162}); err != nil {
		return err
	}

	// t.Repo (string) (string)
	if len("repo") > 1000000 {
		return xerrors.Errorf("Value in field \"repo\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("repo")); err != nil {
		return err
	}

	if len(t.Repo) > 1000000 {
		return xerrors.Errorf("Value in field t.Repo was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Repo)); err != nil {
		return err
	}

	// t.Branch (string) (string)
	if len("branch") > 1000000 {
		return xerrors.Errorf("Value in field \"branch\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("branch")); err != nil {
		return err
	}

	if len(t.Branch) > 1000000 {
		return xerrors.Errorf("Value in field t.Branch was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Branch)); err != nil {
		return err
	}
	return nil
}

func (t *RepoPull_Target) UnmarshalCBOR(r io.Reader) (err error) {
	*t = RepoPull_Target{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("RepoPull_Target: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 6)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.Repo (string) (string)
		case "repo":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Repo = string(sval)
			}
			// t.Branch (string) (string)
		case "branch":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Branch = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *Spindle) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{162}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.spindle"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.spindle")); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *Spindle) UnmarshalCBOR(r io.Reader) (err error) {
	*t = Spindle{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("Spindle: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *SpindleMember) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{164}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.spindle.member"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.spindle.member")); err != nil {
		return err
	}

	// t.Subject (string) (string)
	if len("subject") > 1000000 {
		return xerrors.Errorf("Value in field \"subject\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("subject")); err != nil {
		return err
	}

	if len(t.Subject) > 1000000 {
		return xerrors.Errorf("Value in field t.Subject was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Subject)); err != nil {
		return err
	}

	// t.Instance (string) (string)
	if len("instance") > 1000000 {
		return xerrors.Errorf("Value in field \"instance\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("instance"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("instance")); err != nil {
		return err
	}

	if len(t.Instance) > 1000000 {
		return xerrors.Errorf("Value in field t.Instance was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Instance))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Instance)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}
	return nil
}

func (t *SpindleMember) UnmarshalCBOR(r io.Reader) (err error) {
	*t = SpindleMember{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("SpindleMember: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 9)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Subject (string) (string)
		case "subject":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Subject = string(sval)
			}
			// t.Instance (string) (string)
		case "instance":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Instance = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (t *String) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{165}); err != nil {
		return err
	}

	// t.LexiconTypeID (string) (string)
	if len("$type") > 1000000 {
		return xerrors.Errorf("Value in field \"$type\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("$type")); err != nil {
		return err
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.string"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.string")); err != nil {
		return err
	}

	// t.Contents (string) (string)
	if len("contents") > 1000000 {
		return xerrors.Errorf("Value in field \"contents\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("contents"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("contents")); err != nil {
		return err
	}

	if len(t.Contents) > 1000000 {
		return xerrors.Errorf("Value in field t.Contents was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Contents))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Contents)); err != nil {
		return err
	}

	// t.Filename (string) (string)
	if len("filename") > 1000000 {
		return xerrors.Errorf("Value in field \"filename\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("filename"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("filename")); err != nil {
		return err
	}

	if len(t.Filename) > 1000000 {
		return xerrors.Errorf("Value in field t.Filename was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Filename))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Filename)); err != nil {
		return err
	}

	// t.CreatedAt (string) (string)
	if len("createdAt") > 1000000 {
		return xerrors.Errorf("Value in field \"createdAt\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("createdAt")); err != nil {
		return err
	}

	if len(t.CreatedAt) > 1000000 {
		return xerrors.Errorf("Value in field t.CreatedAt was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
		return err
	}

	// t.Description (string) (string)
	if len("description") > 1000000 {
		return xerrors.Errorf("Value in field \"description\" was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("description"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("description")); err != nil {
		return err
	}

	if len(t.Description) > 1000000 {
		return xerrors.Errorf("Value in field t.Description was too long")
	}

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Description))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Description)); err != nil {
		return err
	}
	return nil
}

func (t *String) UnmarshalCBOR(r io.Reader) (err error) {
	*t = String{}

	cr := cbg.NewCborReader(r)

	maj, extra, err := cr.ReadHeader()
	if err != nil {
		return err
	}
	defer func() {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
	}()

	if maj != cbg.MajMap {
		return fmt.Errorf("cbor input should be of type map")
	}

	if extra > cbg.MaxLength {
		return fmt.Errorf("String: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 11)
	for i := uint64(0); i < n; i++ {
		nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
		if err != nil {
			return err
		}

		if !ok {
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
				return err
			}
			continue
		}

		switch string(nameBuf[:nameLen]) {
		// t.LexiconTypeID (string) (string)
		case "$type":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.LexiconTypeID = string(sval)
			}
			// t.Contents (string) (string)
		case "contents":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Contents = string(sval)
			}
			// t.Filename (string) (string)
		case "filename":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Filename = string(sval)
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.CreatedAt = string(sval)
			}
			// t.Description (string) (string)
		case "description":

			{
				sval, err := cbg.ReadStringWithMax(cr, 1000000)
				if err != nil {
					return err
				}

				t.Description = string(sval)
			}

		default:
			// Field doesn't exist on this type, so ignore it
			if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
				return err
			}
		}
	}

	return nil
}
