From e9f73961d8f11510df9a9dcd658a67b01c600250 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Wed, 05 Nov 2025 08:56:10 +0000 Subject: [PATCH] api/tangled: sync with lexgen Signed-off-by: Seongmin Lee --- api/tangled/actorprofile.go | 5 +++-- api/tangled/cbor_gen.go | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 file(s) changed, 61 insertion(s)(+), 3 deletion(s)(-) diff --git a/api/tangled/actorprofile.go b/api/tangled/actorprofile.go --- a/api/tangled/actorprofile.go +++ b/api/tangled/actorprofile.go @@ -27,6 +27,7 @@ // location: Free-form location text. Location *string `json:"location,omitempty" cborgen:"location,omitempty"` // pinnedRepositories: Any ATURI, it is up to appviews to validate these fields. PinnedRepositories []string `json:"pinnedRepositories,omitempty" cborgen:"pinnedRepositories,omitempty"` - Stats []string `json:"stats,omitempty" cborgen:"stats,omitempty"` - Pronouns *string `json:"pronouns,omitempty" cborgen:"pronouns,omitempty"` + // pronouns: Preferred gender pronouns. + Pronouns *string `json:"pronouns,omitempty" cborgen:"pronouns,omitempty"` + Stats []string `json:"stats,omitempty" cborgen:"stats,omitempty"` } diff --git a/api/tangled/cbor_gen.go b/api/tangled/cbor_gen.go --- a/api/tangled/cbor_gen.go +++ b/api/tangled/cbor_gen.go @@ -26,7 +26,7 @@ return err } cw := cbg.NewCborWriter(w) - fieldCount := 7 + fieldCount := 8 if t.Description == nil { fieldCount-- @@ -41,6 +41,10 @@ fieldCount-- } if t.PinnedRepositories == nil { + fieldCount-- + } + + if t.Pronouns == nil { fieldCount-- } @@ -186,6 +190,38 @@ 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 } } @@ -430,6 +466,27 @@ 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) -- tangled.sh