forked from tangled.org/core
this repo has no description

lexicons: fix trailing comma in sh.tangled.actor.profile

Changed files
+31 -60
api
appview
lexicons
actor
+1 -1
api/tangled/actorprofile.go
···
type ActorProfile struct {
LexiconTypeID string `json:"$type,const=sh.tangled.actor.profile" cborgen:"$type,const=sh.tangled.actor.profile"`
// bluesky: Include link to this account on Bluesky.
-
Bluesky *bool `json:"bluesky,omitempty" cborgen:"bluesky,omitempty"`
+
Bluesky bool `json:"bluesky" cborgen:"bluesky"`
// description: Free-form profile description text.
Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
Links []string `json:"links,omitempty" cborgen:"links,omitempty"`
+25 -53
api/tangled/cbor_gen.go
···
cw := cbg.NewCborWriter(w)
fieldCount := 7
-
if t.Bluesky == nil {
-
fieldCount--
-
}
-
if t.Description == nil {
fieldCount--
···
// t.Bluesky (bool) (bool)
-
if t.Bluesky != nil {
+
if len("bluesky") > 1000000 {
+
return xerrors.Errorf("Value in field \"bluesky\" was too long")
+
}
-
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 := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("bluesky"))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string("bluesky")); err != nil {
-
return err
-
}
-
-
if t.Bluesky == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
if err := cbg.WriteBool(w, *t.Bluesky); err != nil {
-
return err
-
}
-
}
+
if err := cbg.WriteBool(w, t.Bluesky); err != nil {
+
return err
// t.Location (string) (string)
···
// t.Bluesky (bool) (bool)
case "bluesky":
-
{
-
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.Bluesky = &val
-
}
+
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":
+1 -4
appview/ingester.go
···
description = *record.Description
}
-
includeBluesky := false
-
if record.Bluesky != nil {
-
includeBluesky = *record.Bluesky
-
}
+
includeBluesky := record.Bluesky
location := ""
if record.Location != nil {
+1 -1
appview/state/profile.go
···
Rkey: "self",
Record: &lexutil.LexiconTypeDecoder{
Val: &tangled.ActorProfile{
-
Bluesky: &profile.IncludeBluesky,
+
Bluesky: profile.IncludeBluesky,
Description: &profile.Description,
Links: profile.Links[:],
Location: &profile.Location,
+3 -1
lexicons/actor/profile.json
···
"key": "literal:self",
"record": {
"type": "object",
-
"required": ["bluesky"],
+
"required": [
+
"bluesky"
+
],
"properties": {
"description": {
"type": "string",