From fe7ff4dfea17722a43e1a81337d2c70e0691cf3f Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Wed, 5 Nov 2025 17:56:10 +0900 Subject: [PATCH] api/tangled: sync with lexgen Change-Id: pqwvxtlpsvptonsxusoqvpwtmysvkxut Signed-off-by: Seongmin Lee --- api/tangled/actorprofile.go | 5 ++-- api/tangled/cbor_gen.go | 59 ++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/api/tangled/actorprofile.go b/api/tangled/actorprofile.go index c9a130a8..919d7665 100644 --- a/api/tangled/actorprofile.go +++ b/api/tangled/actorprofile.go @@ -27,6 +27,7 @@ type ActorProfile struct { 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 index b74dd068..816f25d5 100644 --- a/api/tangled/cbor_gen.go +++ b/api/tangled/cbor_gen.go @@ -26,7 +26,7 @@ func (t *ActorProfile) MarshalCBOR(w io.Writer) error { } cw := cbg.NewCborWriter(w) - fieldCount := 7 + fieldCount := 8 if t.Description == nil { fieldCount-- @@ -44,6 +44,10 @@ func (t *ActorProfile) MarshalCBOR(w io.Writer) error { fieldCount-- } + if t.Pronouns == nil { + fieldCount-- + } + if t.Stats == nil { fieldCount-- } @@ -191,6 +195,38 @@ func (t *ActorProfile) MarshalCBOR(w io.Writer) error { } } + // 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 { @@ -432,6 +468,27 @@ func (t *ActorProfile) UnmarshalCBOR(r io.Reader) (err error) { 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": -- 2.43.0