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

package tangled

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

	atproto "github.com/bluesky-social/indigo/api/atproto"
	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 := 10

	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.PreferredHandle == 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.PreferredHandle (string) (string)
	if t.PreferredHandle != nil {

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

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

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

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.PreferredHandle))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.PreferredHandle)); 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.PreferredHandle (string) (string)
		case "preferredHandle":

			{
				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.PreferredHandle = (*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 *CiDefs_Pipeline) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

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

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

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

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

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

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

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

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Id))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Id)); 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.Commit (string) (string)
	if len("commit") > 1000000 {
		return xerrors.Errorf("Value in field \"commit\" was too long")
	}

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

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

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

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

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

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

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

		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 t.CreatedAt == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.Workflows ([]*tangled.CiDefs_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
		}

	}
	return nil
}

func (t *CiDefs_Pipeline) UnmarshalCBOR(r io.Reader) (err error) {
	*t = CiDefs_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("CiDefs_Pipeline: 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.Id (string) (string)
		case "id":

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

				t.Id = 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.Commit (string) (string)
		case "commit":

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

				t.Commit = string(sval)
			}
			// t.Trigger (tangled.CiDefs_Pipeline_Trigger) (struct)
		case "trigger":

			{

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

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

			{
				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.CreatedAt = (*string)(&sval)
				}
			}
			// t.Workflows ([]*tangled.CiDefs_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([]*CiDefs_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(CiDefs_Workflow)
							if err := t.Workflows[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Workflows[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 *CiDefs_Pipeline_Trigger) 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.CiTrigger_Push (tangled.CiTrigger_Push) (struct)
	if len("CiTrigger_Push") > 1000000 {
		return xerrors.Errorf("Value in field \"CiTrigger_Push\" was too long")
	}

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

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

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

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

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

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

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

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

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

	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("CiDefs_Pipeline_Trigger: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 21)
	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.CiTrigger_Push (tangled.CiTrigger_Push) (struct)
		case "CiTrigger_Push":

			{

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

			}
			// t.CiTrigger_Manual (tangled.CiTrigger_Manual) (struct)
		case "CiTrigger_Manual":

			{

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

			}
			// t.CiTrigger_PullRequest (tangled.CiTrigger_PullRequest) (struct)
		case "CiTrigger_PullRequest":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.CiTrigger_PullRequest = new(CiTrigger_PullRequest)
					if err := t.CiTrigger_PullRequest.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.CiTrigger_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 *CiDefs_Workflow) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

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

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

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

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

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

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

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

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

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Id))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Id)); 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.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.StartedAt (string) (string)
	if t.StartedAt != nil {

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

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

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

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

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

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

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

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

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

func (t *CiDefs_Workflow) UnmarshalCBOR(r io.Reader) (err error) {
	*t = CiDefs_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("CiDefs_Workflow: 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.Id (string) (string)
		case "id":

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

				t.Id = string(sval)
			}
			// t.Name (string) (string)
		case "name":

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

				t.Name = 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.StartedAt (string) (string)
		case "startedAt":

			{
				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.StartedAt = (*string)(&sval)
				}
			}
			// t.FinishedAt (string) (string)
		case "finishedAt":

			{
				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.FinishedAt = (*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 *CiPipelineSubscribeLogs_Control) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

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

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

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

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

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

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

		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 t.Kind == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.Step (int64) (int64)
	if len("step") > 1000000 {
		return xerrors.Errorf("Value in field \"step\" was too long")
	}

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

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

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

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

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

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

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

		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 t.Status == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.Command (string) (string)
	if t.Command != nil {

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

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

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

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

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

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

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

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Content)); 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
	}
	return nil
}

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

	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("CiPipelineSubscribeLogs_Control: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 8)
	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":

			{
				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.Kind = (*string)(&sval)
				}
			}
			// t.Step (int64) (int64)
		case "step":
			{
				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.Step = int64(extraI)
			}
			// t.Time (string) (string)
		case "time":

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

				t.Time = string(sval)
			}
			// t.Status (string) (string)
		case "status":

			{
				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.Status = (*string)(&sval)
				}
			}
			// t.Command (string) (string)
		case "command":

			{
				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.Command = (*string)(&sval)
				}
			}
			// t.Content (string) (string)
		case "content":

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

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

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

				t.Workflow = 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 *CiPipelineSubscribeLogs_Data) 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.Step (int64) (int64)
	if len("step") > 1000000 {
		return xerrors.Errorf("Value in field \"step\" was too long")
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Content)); 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
	}
	return nil
}

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

	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("CiPipelineSubscribeLogs_Data: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 8)
	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.Step (int64) (int64)
		case "step":
			{
				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.Step = int64(extraI)
			}
			// t.Time (string) (string)
		case "time":

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

				t.Time = string(sval)
			}
			// t.Stream (string) (string)
		case "stream":

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

				t.Stream = string(sval)
			}
			// t.Content (string) (string)
		case "content":

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

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

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

				t.Workflow = 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 *CiTrigger_Manual) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

	cw := cbg.NewCborWriter(w)

	if _, err := cw.Write([]byte{161}); 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.ci.trigger#manual"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.ci.trigger#manual")); err != nil {
		return err
	}
	return nil
}

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

	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("CiTrigger_Manual: 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)
			}

		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 *CiTrigger_PullRequest) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

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

	if t.SourceBranch == 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.ci.trigger#pullRequest"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.ci.trigger#pullRequest")); 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 t.SourceBranch != nil {

		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 t.SourceBranch == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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 *CiTrigger_PullRequest) UnmarshalCBOR(r io.Reader) (err error) {
	*t = CiTrigger_PullRequest{}

	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("CiTrigger_PullRequest: 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.LexiconTypeID (string) (string)
		case "$type":

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

				t.LexiconTypeID = string(sval)
			}
			// 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":

			{
				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.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 *CiTrigger_Push) 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.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.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.ci.trigger#push"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.ci.trigger#push")); 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 *CiTrigger_Push) UnmarshalCBOR(r io.Reader) (err error) {
	*t = CiTrigger_Push{}

	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("CiTrigger_Push: 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.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)
			}

		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 *FeedComment) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

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

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

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

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

	// t.Body (tangled.FeedComment_Body) (struct)
	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 err := t.Body.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.feed.comment"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.feed.comment")); err != nil {
		return err
	}

	// t.ReplyTo (atproto.RepoStrongRef) (struct)
	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 err := t.ReplyTo.MarshalCBOR(cw); err != nil {
			return err
		}
	}

	// t.Subject (atproto.RepoStrongRef) (struct)
	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 err := t.Subject.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
	}

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

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

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

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

	}
	return nil
}

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

	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("FeedComment: 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.Body (tangled.FeedComment_Body) (struct)
		case "body":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Body = new(FeedComment_Body)
					if err := t.Body.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Body 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.ReplyTo (atproto.RepoStrongRef) (struct)
		case "replyTo":

			{

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

			}
			// t.Subject (atproto.RepoStrongRef) (struct)
		case "subject":

			{

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

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

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

				t.CreatedAt = string(sval)
			}
			// t.PullRoundIdx (int64) (int64)
		case "pullRoundIdx":
			{

				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.PullRoundIdx = (*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 *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 (tangled.FeedStar_Subject) (struct)
	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 err := t.Subject.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 *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 (tangled.FeedStar_Subject) (struct)
		case "subject":

			{

				b, err := cr.ReadByte()
				if err != nil {
					return err
				}
				if b != cbg.CborNull[0] {
					if err := cr.UnreadByte(); err != nil {
						return err
					}
					t.Subject = new(FeedStar_Subject)
					if err := t.Subject.UnmarshalCBOR(cr); err != nil {
						return xerrors.Errorf("unmarshaling t.Subject 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 *FeedStar_Repo) 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.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.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#repo"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.feed.star#repo")); err != nil {
		return err
	}
	return nil
}

func (t *FeedStar_Repo) UnmarshalCBOR(r io.Reader) (err error) {
	*t = FeedStar_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("FeedStar_Repo: 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.Did (string) (string)
		case "did":

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

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

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

				t.LexiconTypeID = 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_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{162}); err != nil {
		return err
	}

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

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

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

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Uri))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Uri)); 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#string"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.feed.star#string")); err != nil {
		return err
	}
	return nil
}

func (t *FeedStar_String) UnmarshalCBOR(r io.Reader) (err error) {
	*t = FeedStar_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("FeedStar_String: 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.Uri (string) (string)
		case "uri":

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

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

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

				t.LexiconTypeID = 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)
	fieldCount := 10

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

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

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

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); 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.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.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.OwnerDid (string) (string)
	if t.OwnerDid != nil {

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

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

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

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

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

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

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

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

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.PushOptions))); err != nil {
			return err
		}
		for _, v := range t.PushOptions {
			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.ChangedFiles ([]string) (slice)
	if t.ChangedFiles != nil {

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

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

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

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.ChangedFiles))); err != nil {
			return err
		}
		for _, v := range t.ChangedFiles {
			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.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.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.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.OwnerDid (string) (string)
		case "ownerDid":

			{
				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.OwnerDid = (*string)(&sval)
				}
			}
			// t.PushOptions ([]string) (slice)
		case "pushOptions":

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

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

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

			if extra > 0 {
				t.PushOptions = 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.PushOptions[i] = string(sval)
					}

				}
			}
			// t.ChangedFiles ([]string) (slice)
		case "changedFiles":

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

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

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

			if extra > 0 {
				t.ChangedFiles = 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.ChangedFiles[i] = 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 *GraphVouch) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

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

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

	if t.Reason == 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.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.vouch"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.graph.vouch")); err != nil {
		return err
	}

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

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

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

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

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Reason))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.Reason)); 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.Evidences ([]string) (slice)
	if t.Evidences != nil {

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

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

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

		if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Evidences))); err != nil {
			return err
		}
		for _, v := range t.Evidences {
			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 *GraphVouch) UnmarshalCBOR(r io.Reader) (err error) {
	*t = GraphVouch{}

	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("GraphVouch: 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.Kind (string) (string)
		case "kind":

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

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

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

				t.LexiconTypeID = string(sval)
			}
			// t.Reason (string) (string)
		case "reason":

			{
				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.Reason = (*string)(&sval)
				}
			}
			// t.CreatedAt (string) (string)
		case "createdAt":

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

				t.CreatedAt = string(sval)
			}
			// t.Evidences ([]string) (slice)
		case "evidences":

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

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

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

			if extra > 0 {
				t.Evidences = 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.Evidences[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 *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 *MarkupMarkdown) MarshalCBOR(w io.Writer) error {
	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}

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

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

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

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

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

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

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

	if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Text))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string(t.Text)); 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.markup.markdown"))); err != nil {
		return err
	}
	if _, err := cw.WriteString(string("sh.tangled.markup.markdown")); err != nil {
		return err
	}

	// t.Blobs ([]*util.LexBlob) (slice)
	if t.Blobs != nil {

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

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

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

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

		}
	}

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

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

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

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

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

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

	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("MarkupMarkdown: map struct too large (%d)", extra)
	}

	n := extra

	nameBuf := make([]byte, 8)
	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.Text (string) (string)
		case "text":

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

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

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

				t.LexiconTypeID = string(sval)
			}
			// t.Blobs ([]*util.LexBlob) (slice)
		case "blobs":

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

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

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

			if extra > 0 {
				t.Blobs = make([]*util.LexBlob, 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.Blobs[i] = new(util.LexBlob)
							if err := t.Blobs[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Blobs[i] pointer: %w", err)
							}
						}

					}

				}
			}
			// t.Original (string) (string)
		case "original":

			{
				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.Original = (*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{164}); 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.Tags (bool) (bool)
	if len("tags") > 1000000 {
		return xerrors.Errorf("Value in field \"tags\" was too long")
	}

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

	if err := cbg.WriteBool(w, t.Tags); 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.Tags (bool) (bool)
		case "tags":

			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.Tags = false
			case 21:
				t.Tags = 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 := 3

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

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

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

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

		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 t.Ref == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.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.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.Ref (string) (string)
		case "ref":

			{
				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.Ref = (*string)(&sval)
				}
			}
			// t.Sha (string) (string)
		case "sha":

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

				t.Sha = string(sval)
			}
			// 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)
	fieldCount := 5

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

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

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); 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 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.RepoDid (string) (string)
	if t.RepoDid != nil {

		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 t.RepoDid == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.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":

			{
				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.RepoDid (string) (string)
		case "repoDid":

			{
				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.RepoDid = (*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 := 11

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

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

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

	if t.RepoDid == 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 t.Name != nil {

		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 t.Name == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.RepoDid (string) (string)
	if t.RepoDid != nil {

		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 t.RepoDid == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.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":

			{
				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.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.RepoDid (string) (string)
		case "repoDid":

			{
				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.RepoDid = (*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 := 7

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

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

	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 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.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.RepoDid (string) (string)
	if t.RepoDid != nil {

		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 t.RepoDid == nil {
			if _, err := cw.Write(cbg.CborNull); err != nil {
				return err
			}
		} else {
			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.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":

			{
				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.LexiconTypeID (string) (string)
		case "$type":

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

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

			{
				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.RepoDid = (*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{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.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
	}

	// 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 *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, 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.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)
			}
			// 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 *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.DependentOn == nil {
		fieldCount--
	}

	if t.Mentions == 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.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.Rounds ([]*tangled.RepoPull_Round) (slice)
	if len("rounds") > 1000000 {
		return xerrors.Errorf("Value in field \"rounds\" was too long")
	}

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

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

	if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Rounds))); err != nil {
		return err
	}
	for _, v := range t.Rounds {
		if err := v.MarshalCBOR(cw); 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.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
			}

		}
	}

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

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

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

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

			if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.DependentOn))); err != nil {
				return err
			}
			if _, err := cw.WriteString(string(*t.DependentOn)); 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, 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.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.Title (string) (string)
		case "title":

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

				t.Title = string(sval)
			}
			// t.Rounds ([]*tangled.RepoPull_Round) (slice)
		case "rounds":

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

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

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

			if extra > 0 {
				t.Rounds = make([]*RepoPull_Round, 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.Rounds[i] = new(RepoPull_Round)
							if err := t.Rounds[i].UnmarshalCBOR(cr); err != nil {
								return xerrors.Errorf("unmarshaling t.Rounds[i] pointer: %w", err)
							}
						}

					}

				}
			}
			// 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.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)
					}

				}
			}
			// t.DependentOn (string) (string)
		case "dependentOn":

			{
				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.DependentOn = (*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_Round) 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.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
	}
	return nil
}

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

	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_Round: 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.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)
					}
				}

			}

		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 := 2

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

	if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); 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.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{164}); 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
	}

	// 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 *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, 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.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)
			}
			// 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 *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
}
