Lewis: May this revision serve well! lewis@tangled.org
+553
-622
Diff
round #5
+413
-565
api/tangled/cbor_gen.go
+413
-565
api/tangled/cbor_gen.go
···
866
866
}
867
867
868
868
cw := cbg.NewCborWriter(w)
869
-
fieldCount := 4
870
-
871
-
if t.Subject == nil {
872
-
fieldCount--
873
-
}
874
-
875
-
if t.SubjectDid == nil {
876
-
fieldCount--
877
-
}
878
869
879
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
870
+
if _, err := cw.Write([]byte{163}); err != nil {
880
871
return err
881
872
}
882
873
···
899
890
return err
900
891
}
901
892
902
-
// t.Subject (string) (string)
903
-
if t.Subject != nil {
904
-
905
-
if len("subject") > 1000000 {
906
-
return xerrors.Errorf("Value in field \"subject\" was too long")
907
-
}
908
-
909
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
910
-
return err
911
-
}
912
-
if _, err := cw.WriteString(string("subject")); err != nil {
913
-
return err
914
-
}
893
+
// t.Subject (tangled.FeedStar_Subject) (struct)
894
+
if len("subject") > 1000000 {
895
+
return xerrors.Errorf("Value in field \"subject\" was too long")
896
+
}
915
897
916
-
if t.Subject == nil {
917
-
if _, err := cw.Write(cbg.CborNull); err != nil {
918
-
return err
919
-
}
920
-
} else {
921
-
if len(*t.Subject) > 1000000 {
922
-
return xerrors.Errorf("Value in field t.Subject was too long")
923
-
}
898
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil {
899
+
return err
900
+
}
901
+
if _, err := cw.WriteString(string("subject")); err != nil {
902
+
return err
903
+
}
924
904
925
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Subject))); err != nil {
926
-
return err
927
-
}
928
-
if _, err := cw.WriteString(string(*t.Subject)); err != nil {
929
-
return err
930
-
}
931
-
}
905
+
if err := t.Subject.MarshalCBOR(cw); err != nil {
906
+
return err
932
907
}
933
908
934
909
// t.CreatedAt (string) (string)
···
953
928
if _, err := cw.WriteString(string(t.CreatedAt)); err != nil {
954
929
return err
955
930
}
956
-
957
-
// t.SubjectDid (string) (string)
958
-
if t.SubjectDid != nil {
959
-
960
-
if len("subjectDid") > 1000000 {
961
-
return xerrors.Errorf("Value in field \"subjectDid\" was too long")
962
-
}
963
-
964
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subjectDid"))); err != nil {
965
-
return err
966
-
}
967
-
if _, err := cw.WriteString(string("subjectDid")); err != nil {
968
-
return err
969
-
}
970
-
971
-
if t.SubjectDid == nil {
972
-
if _, err := cw.Write(cbg.CborNull); err != nil {
973
-
return err
974
-
}
975
-
} else {
976
-
if len(*t.SubjectDid) > 1000000 {
977
-
return xerrors.Errorf("Value in field t.SubjectDid was too long")
978
-
}
979
-
980
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SubjectDid))); err != nil {
981
-
return err
982
-
}
983
-
if _, err := cw.WriteString(string(*t.SubjectDid)); err != nil {
984
-
return err
985
-
}
986
-
}
987
-
}
988
931
return nil
989
932
}
990
933
···
1013
956
1014
957
n := extra
1015
958
1016
-
nameBuf := make([]byte, 10)
959
+
nameBuf := make([]byte, 9)
1017
960
for i := uint64(0); i < n; i++ {
1018
961
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1019
962
if err != nil {
···
1040
983
1041
984
t.LexiconTypeID = string(sval)
1042
985
}
1043
-
// t.Subject (string) (string)
986
+
// t.Subject (tangled.FeedStar_Subject) (struct)
1044
987
case "subject":
1045
988
1046
989
{
990
+
1047
991
b, err := cr.ReadByte()
1048
992
if err != nil {
1049
993
return err
···
1052
996
if err := cr.UnreadByte(); err != nil {
1053
997
return err
1054
998
}
1055
-
1056
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1057
-
if err != nil {
1058
-
return err
999
+
t.Subject = new(FeedStar_Subject)
1000
+
if err := t.Subject.UnmarshalCBOR(cr); err != nil {
1001
+
return xerrors.Errorf("unmarshaling t.Subject pointer: %w", err)
1059
1002
}
1060
-
1061
-
t.Subject = (*string)(&sval)
1062
1003
}
1004
+
1063
1005
}
1064
1006
// t.CreatedAt (string) (string)
1065
1007
case "createdAt":
···
1072
1014
1073
1015
t.CreatedAt = string(sval)
1074
1016
}
1075
-
// t.SubjectDid (string) (string)
1076
-
case "subjectDid":
1017
+
1018
+
default:
1019
+
// Field doesn't exist on this type, so ignore it
1020
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1021
+
return err
1022
+
}
1023
+
}
1024
+
}
1025
+
1026
+
return nil
1027
+
}
1028
+
func (t *FeedStar_Repo) MarshalCBOR(w io.Writer) error {
1029
+
if t == nil {
1030
+
_, err := w.Write(cbg.CborNull)
1031
+
return err
1032
+
}
1033
+
1034
+
cw := cbg.NewCborWriter(w)
1035
+
1036
+
if _, err := cw.Write([]byte{162}); err != nil {
1037
+
return err
1038
+
}
1039
+
1040
+
// t.Did (string) (string)
1041
+
if len("did") > 1000000 {
1042
+
return xerrors.Errorf("Value in field \"did\" was too long")
1043
+
}
1044
+
1045
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("did"))); err != nil {
1046
+
return err
1047
+
}
1048
+
if _, err := cw.WriteString(string("did")); err != nil {
1049
+
return err
1050
+
}
1051
+
1052
+
if len(t.Did) > 1000000 {
1053
+
return xerrors.Errorf("Value in field t.Did was too long")
1054
+
}
1055
+
1056
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Did))); err != nil {
1057
+
return err
1058
+
}
1059
+
if _, err := cw.WriteString(string(t.Did)); err != nil {
1060
+
return err
1061
+
}
1062
+
1063
+
// t.LexiconTypeID (string) (string)
1064
+
if len("$type") > 1000000 {
1065
+
return xerrors.Errorf("Value in field \"$type\" was too long")
1066
+
}
1067
+
1068
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1069
+
return err
1070
+
}
1071
+
if _, err := cw.WriteString(string("$type")); err != nil {
1072
+
return err
1073
+
}
1074
+
1075
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.feed.star#repo"))); err != nil {
1076
+
return err
1077
+
}
1078
+
if _, err := cw.WriteString(string("sh.tangled.feed.star#repo")); err != nil {
1079
+
return err
1080
+
}
1081
+
return nil
1082
+
}
1083
+
1084
+
func (t *FeedStar_Repo) UnmarshalCBOR(r io.Reader) (err error) {
1085
+
*t = FeedStar_Repo{}
1086
+
1087
+
cr := cbg.NewCborReader(r)
1088
+
1089
+
maj, extra, err := cr.ReadHeader()
1090
+
if err != nil {
1091
+
return err
1092
+
}
1093
+
defer func() {
1094
+
if err == io.EOF {
1095
+
err = io.ErrUnexpectedEOF
1096
+
}
1097
+
}()
1098
+
1099
+
if maj != cbg.MajMap {
1100
+
return fmt.Errorf("cbor input should be of type map")
1101
+
}
1102
+
1103
+
if extra > cbg.MaxLength {
1104
+
return fmt.Errorf("FeedStar_Repo: map struct too large (%d)", extra)
1105
+
}
1106
+
1107
+
n := extra
1108
+
1109
+
nameBuf := make([]byte, 5)
1110
+
for i := uint64(0); i < n; i++ {
1111
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1112
+
if err != nil {
1113
+
return err
1114
+
}
1115
+
1116
+
if !ok {
1117
+
// Field doesn't exist on this type, so ignore it
1118
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1119
+
return err
1120
+
}
1121
+
continue
1122
+
}
1123
+
1124
+
switch string(nameBuf[:nameLen]) {
1125
+
// t.Did (string) (string)
1126
+
case "did":
1077
1127
1078
1128
{
1079
-
b, err := cr.ReadByte()
1129
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1080
1130
if err != nil {
1081
1131
return err
1082
1132
}
1083
-
if b != cbg.CborNull[0] {
1084
-
if err := cr.UnreadByte(); err != nil {
1085
-
return err
1086
-
}
1087
1133
1088
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1089
-
if err != nil {
1090
-
return err
1091
-
}
1134
+
t.Did = string(sval)
1135
+
}
1136
+
// t.LexiconTypeID (string) (string)
1137
+
case "$type":
1092
1138
1093
-
t.SubjectDid = (*string)(&sval)
1139
+
{
1140
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1141
+
if err != nil {
1142
+
return err
1094
1143
}
1144
+
1145
+
t.LexiconTypeID = string(sval)
1095
1146
}
1096
1147
1097
1148
default:
···
1104
1155
1105
1156
return nil
1106
1157
}
1107
-
func (t *GitRefUpdate) MarshalCBOR(w io.Writer) error {
1158
+
func (t *FeedStar_String) MarshalCBOR(w io.Writer) error {
1108
1159
if t == nil {
1109
1160
_, err := w.Write(cbg.CborNull)
1110
1161
return err
1111
1162
}
1112
1163
1113
1164
cw := cbg.NewCborWriter(w)
1114
-
fieldCount := 9
1115
1165
1116
-
if t.OwnerDid == nil {
1117
-
fieldCount--
1166
+
if _, err := cw.Write([]byte{162}); err != nil {
1167
+
return err
1118
1168
}
1119
1169
1120
-
if t.RepoDid == nil {
1170
+
// t.Uri (string) (string)
1171
+
if len("uri") > 1000000 {
1172
+
return xerrors.Errorf("Value in field \"uri\" was too long")
1173
+
}
1174
+
1175
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("uri"))); err != nil {
1176
+
return err
1177
+
}
1178
+
if _, err := cw.WriteString(string("uri")); err != nil {
1179
+
return err
1180
+
}
1181
+
1182
+
if len(t.Uri) > 1000000 {
1183
+
return xerrors.Errorf("Value in field t.Uri was too long")
1184
+
}
1185
+
1186
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Uri))); err != nil {
1187
+
return err
1188
+
}
1189
+
if _, err := cw.WriteString(string(t.Uri)); err != nil {
1190
+
return err
1191
+
}
1192
+
1193
+
// t.LexiconTypeID (string) (string)
1194
+
if len("$type") > 1000000 {
1195
+
return xerrors.Errorf("Value in field \"$type\" was too long")
1196
+
}
1197
+
1198
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
1199
+
return err
1200
+
}
1201
+
if _, err := cw.WriteString(string("$type")); err != nil {
1202
+
return err
1203
+
}
1204
+
1205
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.feed.star#string"))); err != nil {
1206
+
return err
1207
+
}
1208
+
if _, err := cw.WriteString(string("sh.tangled.feed.star#string")); err != nil {
1209
+
return err
1210
+
}
1211
+
return nil
1212
+
}
1213
+
1214
+
func (t *FeedStar_String) UnmarshalCBOR(r io.Reader) (err error) {
1215
+
*t = FeedStar_String{}
1216
+
1217
+
cr := cbg.NewCborReader(r)
1218
+
1219
+
maj, extra, err := cr.ReadHeader()
1220
+
if err != nil {
1221
+
return err
1222
+
}
1223
+
defer func() {
1224
+
if err == io.EOF {
1225
+
err = io.ErrUnexpectedEOF
1226
+
}
1227
+
}()
1228
+
1229
+
if maj != cbg.MajMap {
1230
+
return fmt.Errorf("cbor input should be of type map")
1231
+
}
1232
+
1233
+
if extra > cbg.MaxLength {
1234
+
return fmt.Errorf("FeedStar_String: map struct too large (%d)", extra)
1235
+
}
1236
+
1237
+
n := extra
1238
+
1239
+
nameBuf := make([]byte, 5)
1240
+
for i := uint64(0); i < n; i++ {
1241
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1242
+
if err != nil {
1243
+
return err
1244
+
}
1245
+
1246
+
if !ok {
1247
+
// Field doesn't exist on this type, so ignore it
1248
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1249
+
return err
1250
+
}
1251
+
continue
1252
+
}
1253
+
1254
+
switch string(nameBuf[:nameLen]) {
1255
+
// t.Uri (string) (string)
1256
+
case "uri":
1257
+
1258
+
{
1259
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1260
+
if err != nil {
1261
+
return err
1262
+
}
1263
+
1264
+
t.Uri = string(sval)
1265
+
}
1266
+
// t.LexiconTypeID (string) (string)
1267
+
case "$type":
1268
+
1269
+
{
1270
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1271
+
if err != nil {
1272
+
return err
1273
+
}
1274
+
1275
+
t.LexiconTypeID = string(sval)
1276
+
}
1277
+
1278
+
default:
1279
+
// Field doesn't exist on this type, so ignore it
1280
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1281
+
return err
1282
+
}
1283
+
}
1284
+
}
1285
+
1286
+
return nil
1287
+
}
1288
+
func (t *GitRefUpdate) MarshalCBOR(w io.Writer) error {
1289
+
if t == nil {
1290
+
_, err := w.Write(cbg.CborNull)
1291
+
return err
1292
+
}
1293
+
1294
+
cw := cbg.NewCborWriter(w)
1295
+
fieldCount := 8
1296
+
1297
+
if t.OwnerDid == nil {
1121
1298
fieldCount--
1122
1299
}
1123
1300
···
1164
1341
return err
1165
1342
}
1166
1343
1344
+
// t.Repo (string) (string)
1345
+
if len("repo") > 1000000 {
1346
+
return xerrors.Errorf("Value in field \"repo\" was too long")
1347
+
}
1348
+
1349
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
1350
+
return err
1351
+
}
1352
+
if _, err := cw.WriteString(string("repo")); err != nil {
1353
+
return err
1354
+
}
1355
+
1356
+
if len(t.Repo) > 1000000 {
1357
+
return xerrors.Errorf("Value in field t.Repo was too long")
1358
+
}
1359
+
1360
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
1361
+
return err
1362
+
}
1363
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
1364
+
return err
1365
+
}
1366
+
1167
1367
// t.LexiconTypeID (string) (string)
1168
1368
if len("$type") > 1000000 {
1169
1369
return xerrors.Errorf("Value in field \"$type\" was too long")
···
1225
1425
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil {
1226
1426
return err
1227
1427
}
1228
-
if _, err := cw.WriteString(string(t.OldSha)); err != nil {
1229
-
return err
1230
-
}
1231
-
1232
-
// t.RepoDid (string) (string)
1233
-
if t.RepoDid != nil {
1234
-
1235
-
if len("repoDid") > 1000000 {
1236
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
1237
-
}
1238
-
1239
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
1240
-
return err
1241
-
}
1242
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
1243
-
return err
1244
-
}
1245
-
1246
-
if t.RepoDid == nil {
1247
-
if _, err := cw.Write(cbg.CborNull); err != nil {
1248
-
return err
1249
-
}
1250
-
} else {
1251
-
if len(*t.RepoDid) > 1000000 {
1252
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
1253
-
}
1254
-
1255
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
1256
-
return err
1257
-
}
1258
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
1259
-
return err
1260
-
}
1261
-
}
1262
-
}
1428
+
if _, err := cw.WriteString(string(t.OldSha)); err != nil {
1429
+
return err
1430
+
}
1263
1431
1264
1432
// t.OwnerDid (string) (string)
1265
1433
if t.OwnerDid != nil {
···
1293
1461
}
1294
1462
}
1295
1463
1296
-
// t.RepoName (string) (string)
1297
-
if len("repoName") > 1000000 {
1298
-
return xerrors.Errorf("Value in field \"repoName\" was too long")
1299
-
}
1300
-
1301
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoName"))); err != nil {
1302
-
return err
1303
-
}
1304
-
if _, err := cw.WriteString(string("repoName")); err != nil {
1305
-
return err
1306
-
}
1307
-
1308
-
if len(t.RepoName) > 1000000 {
1309
-
return xerrors.Errorf("Value in field t.RepoName was too long")
1310
-
}
1311
-
1312
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoName))); err != nil {
1313
-
return err
1314
-
}
1315
-
if _, err := cw.WriteString(string(t.RepoName)); err != nil {
1316
-
return err
1317
-
}
1318
-
1319
1464
// t.CommitterDid (string) (string)
1320
1465
if len("committerDid") > 1000000 {
1321
1466
return xerrors.Errorf("Value in field \"committerDid\" was too long")
···
1413
1558
}
1414
1559
1415
1560
}
1561
+
// t.Repo (string) (string)
1562
+
case "repo":
1563
+
1564
+
{
1565
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1566
+
if err != nil {
1567
+
return err
1568
+
}
1569
+
1570
+
t.Repo = string(sval)
1571
+
}
1416
1572
// t.LexiconTypeID (string) (string)
1417
1573
case "$type":
1418
1574
···
1446
1602
1447
1603
t.OldSha = string(sval)
1448
1604
}
1449
-
// t.RepoDid (string) (string)
1450
-
case "repoDid":
1451
-
1452
-
{
1453
-
b, err := cr.ReadByte()
1454
-
if err != nil {
1455
-
return err
1456
-
}
1457
-
if b != cbg.CborNull[0] {
1458
-
if err := cr.UnreadByte(); err != nil {
1459
-
return err
1460
-
}
1461
-
1462
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1463
-
if err != nil {
1464
-
return err
1465
-
}
1466
-
1467
-
t.RepoDid = (*string)(&sval)
1468
-
}
1469
-
}
1470
1605
// t.OwnerDid (string) (string)
1471
1606
case "ownerDid":
1472
1607
···
1488
1623
t.OwnerDid = (*string)(&sval)
1489
1624
}
1490
1625
}
1491
-
// t.RepoName (string) (string)
1492
-
case "repoName":
1493
-
1494
-
{
1495
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
1496
-
if err != nil {
1497
-
return err
1498
-
}
1499
-
1500
-
t.RepoName = string(sval)
1501
-
}
1502
1626
// t.CommitterDid (string) (string)
1503
1627
case "committerDid":
1504
1628
···
6438
6562
fieldCount--
6439
6563
}
6440
6564
6565
+
if t.Name == nil {
6566
+
fieldCount--
6567
+
}
6568
+
6441
6569
if t.RepoDid == nil {
6442
6570
fieldCount--
6443
6571
}
···
6486
6614
}
6487
6615
6488
6616
// t.Name (string) (string)
6489
-
if len("name") > 1000000 {
6490
-
return xerrors.Errorf("Value in field \"name\" was too long")
6491
-
}
6617
+
if t.Name != nil {
6492
6618
6493
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
6494
-
return err
6495
-
}
6496
-
if _, err := cw.WriteString(string("name")); err != nil {
6497
-
return err
6498
-
}
6619
+
if len("name") > 1000000 {
6620
+
return xerrors.Errorf("Value in field \"name\" was too long")
6621
+
}
6499
6622
6500
-
if len(t.Name) > 1000000 {
6501
-
return xerrors.Errorf("Value in field t.Name was too long")
6502
-
}
6623
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
6624
+
return err
6625
+
}
6626
+
if _, err := cw.WriteString(string("name")); err != nil {
6627
+
return err
6628
+
}
6503
6629
6504
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
6505
-
return err
6506
-
}
6507
-
if _, err := cw.WriteString(string(t.Name)); err != nil {
6508
-
return err
6630
+
if t.Name == nil {
6631
+
if _, err := cw.Write(cbg.CborNull); err != nil {
6632
+
return err
6633
+
}
6634
+
} else {
6635
+
if len(*t.Name) > 1000000 {
6636
+
return xerrors.Errorf("Value in field t.Name was too long")
6637
+
}
6638
+
6639
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Name))); err != nil {
6640
+
return err
6641
+
}
6642
+
if _, err := cw.WriteString(string(*t.Name)); err != nil {
6643
+
return err
6644
+
}
6645
+
}
6509
6646
}
6510
6647
6511
6648
// t.LexiconTypeID (string) (string)
···
6840
6977
case "name":
6841
6978
6842
6979
{
6843
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
6980
+
b, err := cr.ReadByte()
6844
6981
if err != nil {
6845
6982
return err
6846
6983
}
6984
+
if b != cbg.CborNull[0] {
6985
+
if err := cr.UnreadByte(); err != nil {
6986
+
return err
6987
+
}
6847
6988
6848
-
t.Name = string(sval)
6989
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
6990
+
if err != nil {
6991
+
return err
6992
+
}
6993
+
6994
+
t.Name = (*string)(&sval)
6995
+
}
6849
6996
}
6850
6997
// t.LexiconTypeID (string) (string)
6851
6998
case "$type":
···
7442
7589
}
7443
7590
7444
7591
cw := cbg.NewCborWriter(w)
7445
-
fieldCount := 5
7446
7592
7447
-
if t.Repo == nil {
7448
-
fieldCount--
7593
+
if _, err := cw.Write([]byte{164}); err != nil {
7594
+
return err
7449
7595
}
7450
7596
7451
-
if t.RepoDid == nil {
7452
-
fieldCount--
7597
+
// t.Repo (string) (string)
7598
+
if len("repo") > 1000000 {
7599
+
return xerrors.Errorf("Value in field \"repo\" was too long")
7453
7600
}
7454
7601
7455
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
7602
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7603
+
return err
7604
+
}
7605
+
if _, err := cw.WriteString(string("repo")); err != nil {
7456
7606
return err
7457
7607
}
7458
7608
7459
-
// t.Repo (string) (string)
7460
-
if t.Repo != nil {
7461
-
7462
-
if len("repo") > 1000000 {
7463
-
return xerrors.Errorf("Value in field \"repo\" was too long")
7464
-
}
7465
-
7466
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7467
-
return err
7468
-
}
7469
-
if _, err := cw.WriteString(string("repo")); err != nil {
7470
-
return err
7471
-
}
7472
-
7473
-
if t.Repo == nil {
7474
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7475
-
return err
7476
-
}
7477
-
} else {
7478
-
if len(*t.Repo) > 1000000 {
7479
-
return xerrors.Errorf("Value in field t.Repo was too long")
7480
-
}
7609
+
if len(t.Repo) > 1000000 {
7610
+
return xerrors.Errorf("Value in field t.Repo was too long")
7611
+
}
7481
7612
7482
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
7483
-
return err
7484
-
}
7485
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
7486
-
return err
7487
-
}
7488
-
}
7613
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
7614
+
return err
7615
+
}
7616
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
7617
+
return err
7489
7618
}
7490
7619
7491
7620
// t.LexiconTypeID (string) (string)
···
7507
7636
return err
7508
7637
}
7509
7638
7510
-
// t.RepoDid (string) (string)
7511
-
if t.RepoDid != nil {
7512
-
7513
-
if len("repoDid") > 1000000 {
7514
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
7515
-
}
7516
-
7517
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
7518
-
return err
7519
-
}
7520
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
7521
-
return err
7522
-
}
7523
-
7524
-
if t.RepoDid == nil {
7525
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7526
-
return err
7527
-
}
7528
-
} else {
7529
-
if len(*t.RepoDid) > 1000000 {
7530
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
7531
-
}
7532
-
7533
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
7534
-
return err
7535
-
}
7536
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
7537
-
return err
7538
-
}
7539
-
}
7540
-
}
7541
-
7542
7639
// t.Subject (string) (string)
7543
7640
if len("subject") > 1000000 {
7544
7641
return xerrors.Errorf("Value in field \"subject\" was too long")
···
7632
7729
case "repo":
7633
7730
7634
7731
{
7635
-
b, err := cr.ReadByte()
7732
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7636
7733
if err != nil {
7637
7734
return err
7638
7735
}
7639
-
if b != cbg.CborNull[0] {
7640
-
if err := cr.UnreadByte(); err != nil {
7641
-
return err
7642
-
}
7643
-
7644
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7645
-
if err != nil {
7646
-
return err
7647
-
}
7648
7736
7649
-
t.Repo = (*string)(&sval)
7650
-
}
7737
+
t.Repo = string(sval)
7651
7738
}
7652
7739
// t.LexiconTypeID (string) (string)
7653
7740
case "$type":
···
7660
7747
7661
7748
t.LexiconTypeID = string(sval)
7662
7749
}
7663
-
// t.RepoDid (string) (string)
7664
-
case "repoDid":
7665
-
7666
-
{
7667
-
b, err := cr.ReadByte()
7668
-
if err != nil {
7669
-
return err
7670
-
}
7671
-
if b != cbg.CborNull[0] {
7672
-
if err := cr.UnreadByte(); err != nil {
7673
-
return err
7674
-
}
7675
-
7676
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7677
-
if err != nil {
7678
-
return err
7679
-
}
7680
-
7681
-
t.RepoDid = (*string)(&sval)
7682
-
}
7683
-
}
7684
7750
// t.Subject (string) (string)
7685
7751
case "subject":
7686
7752
···
7721
7787
}
7722
7788
7723
7789
cw := cbg.NewCborWriter(w)
7724
-
fieldCount := 8
7790
+
fieldCount := 7
7725
7791
7726
7792
if t.Body == nil {
7727
7793
fieldCount--
···
7735
7801
fieldCount--
7736
7802
}
7737
7803
7738
-
if t.Repo == nil {
7739
-
fieldCount--
7740
-
}
7741
-
7742
-
if t.RepoDid == nil {
7743
-
fieldCount--
7744
-
}
7745
-
7746
7804
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
7747
7805
return err
7748
7806
}
···
7780
7838
}
7781
7839
7782
7840
// t.Repo (string) (string)
7783
-
if t.Repo != nil {
7784
-
7785
-
if len("repo") > 1000000 {
7786
-
return xerrors.Errorf("Value in field \"repo\" was too long")
7787
-
}
7788
-
7789
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7790
-
return err
7791
-
}
7792
-
if _, err := cw.WriteString(string("repo")); err != nil {
7793
-
return err
7794
-
}
7841
+
if len("repo") > 1000000 {
7842
+
return xerrors.Errorf("Value in field \"repo\" was too long")
7843
+
}
7795
7844
7796
-
if t.Repo == nil {
7797
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7798
-
return err
7799
-
}
7800
-
} else {
7801
-
if len(*t.Repo) > 1000000 {
7802
-
return xerrors.Errorf("Value in field t.Repo was too long")
7803
-
}
7845
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7846
+
return err
7847
+
}
7848
+
if _, err := cw.WriteString(string("repo")); err != nil {
7849
+
return err
7850
+
}
7804
7851
7805
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
7806
-
return err
7807
-
}
7808
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
7809
-
return err
7810
-
}
7811
-
}
7852
+
if len(t.Repo) > 1000000 {
7853
+
return xerrors.Errorf("Value in field t.Repo was too long")
7854
+
}
7855
+
7856
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
7857
+
return err
7858
+
}
7859
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
7860
+
return err
7812
7861
}
7813
7862
7814
7863
// t.LexiconTypeID (string) (string)
···
7853
7902
return err
7854
7903
}
7855
7904
7856
-
// t.RepoDid (string) (string)
7857
-
if t.RepoDid != nil {
7858
-
7859
-
if len("repoDid") > 1000000 {
7860
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
7861
-
}
7862
-
7863
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
7864
-
return err
7865
-
}
7866
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
7867
-
return err
7868
-
}
7869
-
7870
-
if t.RepoDid == nil {
7871
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7872
-
return err
7873
-
}
7874
-
} else {
7875
-
if len(*t.RepoDid) > 1000000 {
7876
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
7877
-
}
7878
-
7879
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
7880
-
return err
7881
-
}
7882
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
7883
-
return err
7884
-
}
7885
-
}
7886
-
}
7887
-
7888
7905
// t.Mentions ([]string) (slice)
7889
7906
if t.Mentions != nil {
7890
7907
···
8048
8065
case "repo":
8049
8066
8050
8067
{
8051
-
b, err := cr.ReadByte()
8068
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
8052
8069
if err != nil {
8053
8070
return err
8054
8071
}
8055
-
if b != cbg.CborNull[0] {
8056
-
if err := cr.UnreadByte(); err != nil {
8057
-
return err
8058
-
}
8059
-
8060
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
8061
-
if err != nil {
8062
-
return err
8063
-
}
8064
8072
8065
-
t.Repo = (*string)(&sval)
8066
-
}
8073
+
t.Repo = string(sval)
8067
8074
}
8068
8075
// t.LexiconTypeID (string) (string)
8069
8076
case "$type":
···
8087
8094
8088
8095
t.Title = string(sval)
8089
8096
}
8090
-
// t.RepoDid (string) (string)
8091
-
case "repoDid":
8092
-
8093
-
{
8094
-
b, err := cr.ReadByte()
8095
-
if err != nil {
8096
-
return err
8097
-
}
8098
-
if b != cbg.CborNull[0] {
8099
-
if err := cr.UnreadByte(); err != nil {
8100
-
return err
8101
-
}
8102
-
8103
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
8104
-
if err != nil {
8105
-
return err
8106
-
}
8107
-
8108
-
t.RepoDid = (*string)(&sval)
8109
-
}
8110
-
}
8111
8097
// t.Mentions ([]string) (slice)
8112
8098
case "mentions":
8113
8099
···
9885
9871
}
9886
9872
9887
9873
cw := cbg.NewCborWriter(w)
9888
-
fieldCount := 3
9874
+
fieldCount := 2
9889
9875
9890
9876
if t.Repo == nil {
9891
9877
fieldCount--
9892
9878
}
9893
9879
9894
-
if t.RepoDid == nil {
9895
-
fieldCount--
9896
-
}
9897
-
9898
9880
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
9899
9881
return err
9900
9882
}
···
9953
9935
if _, err := cw.WriteString(string(t.Branch)); err != nil {
9954
9936
return err
9955
9937
}
9956
-
9957
-
// t.RepoDid (string) (string)
9958
-
if t.RepoDid != nil {
9959
-
9960
-
if len("repoDid") > 1000000 {
9961
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
9962
-
}
9963
-
9964
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
9965
-
return err
9966
-
}
9967
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
9968
-
return err
9969
-
}
9970
-
9971
-
if t.RepoDid == nil {
9972
-
if _, err := cw.Write(cbg.CborNull); err != nil {
9973
-
return err
9974
-
}
9975
-
} else {
9976
-
if len(*t.RepoDid) > 1000000 {
9977
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
9978
-
}
9979
-
9980
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
9981
-
return err
9982
-
}
9983
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
9984
-
return err
9985
-
}
9986
-
}
9987
-
}
9988
9938
return nil
9989
9939
}
9990
9940
···
10013
9963
10014
9964
n := extra
10015
9965
10016
-
nameBuf := make([]byte, 7)
9966
+
nameBuf := make([]byte, 6)
10017
9967
for i := uint64(0); i < n; i++ {
10018
9968
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
10019
9969
if err != nil {
···
10061
10011
10062
10012
t.Branch = string(sval)
10063
10013
}
10064
-
// t.RepoDid (string) (string)
10065
-
case "repoDid":
10066
-
10067
-
{
10068
-
b, err := cr.ReadByte()
10069
-
if err != nil {
10070
-
return err
10071
-
}
10072
-
if b != cbg.CborNull[0] {
10073
-
if err := cr.UnreadByte(); err != nil {
10074
-
return err
10075
-
}
10076
-
10077
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10078
-
if err != nil {
10079
-
return err
10080
-
}
10081
-
10082
-
t.RepoDid = (*string)(&sval)
10083
-
}
10084
-
}
10085
10014
10086
10015
default:
10087
10016
// Field doesn't exist on this type, so ignore it
···
10264
10193
}
10265
10194
10266
10195
cw := cbg.NewCborWriter(w)
10267
-
fieldCount := 3
10268
10196
10269
-
if t.Repo == nil {
10270
-
fieldCount--
10197
+
if _, err := cw.Write([]byte{162}); err != nil {
10198
+
return err
10271
10199
}
10272
10200
10273
-
if t.RepoDid == nil {
10274
-
fieldCount--
10201
+
// t.Repo (string) (string)
10202
+
if len("repo") > 1000000 {
10203
+
return xerrors.Errorf("Value in field \"repo\" was too long")
10275
10204
}
10276
10205
10277
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
10206
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
10207
+
return err
10208
+
}
10209
+
if _, err := cw.WriteString(string("repo")); err != nil {
10278
10210
return err
10279
10211
}
10280
10212
10281
-
// t.Repo (string) (string)
10282
-
if t.Repo != nil {
10283
-
10284
-
if len("repo") > 1000000 {
10285
-
return xerrors.Errorf("Value in field \"repo\" was too long")
10286
-
}
10287
-
10288
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
10289
-
return err
10290
-
}
10291
-
if _, err := cw.WriteString(string("repo")); err != nil {
10292
-
return err
10293
-
}
10294
-
10295
-
if t.Repo == nil {
10296
-
if _, err := cw.Write(cbg.CborNull); err != nil {
10297
-
return err
10298
-
}
10299
-
} else {
10300
-
if len(*t.Repo) > 1000000 {
10301
-
return xerrors.Errorf("Value in field t.Repo was too long")
10302
-
}
10213
+
if len(t.Repo) > 1000000 {
10214
+
return xerrors.Errorf("Value in field t.Repo was too long")
10215
+
}
10303
10216
10304
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
10305
-
return err
10306
-
}
10307
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
10308
-
return err
10309
-
}
10310
-
}
10217
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
10218
+
return err
10219
+
}
10220
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
10221
+
return err
10311
10222
}
10312
10223
10313
10224
// t.Branch (string) (string)
···
10332
10243
if _, err := cw.WriteString(string(t.Branch)); err != nil {
10333
10244
return err
10334
10245
}
10335
-
10336
-
// t.RepoDid (string) (string)
10337
-
if t.RepoDid != nil {
10338
-
10339
-
if len("repoDid") > 1000000 {
10340
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
10341
-
}
10342
-
10343
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
10344
-
return err
10345
-
}
10346
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
10347
-
return err
10348
-
}
10349
-
10350
-
if t.RepoDid == nil {
10351
-
if _, err := cw.Write(cbg.CborNull); err != nil {
10352
-
return err
10353
-
}
10354
-
} else {
10355
-
if len(*t.RepoDid) > 1000000 {
10356
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
10357
-
}
10358
-
10359
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
10360
-
return err
10361
-
}
10362
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
10363
-
return err
10364
-
}
10365
-
}
10366
-
}
10367
10246
return nil
10368
10247
}
10369
10248
···
10392
10271
10393
10272
n := extra
10394
10273
10395
-
nameBuf := make([]byte, 7)
10274
+
nameBuf := make([]byte, 6)
10396
10275
for i := uint64(0); i < n; i++ {
10397
10276
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
10398
10277
if err != nil {
···
10412
10291
case "repo":
10413
10292
10414
10293
{
10415
-
b, err := cr.ReadByte()
10294
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10416
10295
if err != nil {
10417
10296
return err
10418
10297
}
10419
-
if b != cbg.CborNull[0] {
10420
-
if err := cr.UnreadByte(); err != nil {
10421
-
return err
10422
-
}
10423
-
10424
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10425
-
if err != nil {
10426
-
return err
10427
-
}
10428
10298
10429
-
t.Repo = (*string)(&sval)
10430
-
}
10299
+
t.Repo = string(sval)
10431
10300
}
10432
10301
// t.Branch (string) (string)
10433
10302
case "branch":
···
10440
10309
10441
10310
t.Branch = string(sval)
10442
10311
}
10443
-
// t.RepoDid (string) (string)
10444
-
case "repoDid":
10445
-
10446
-
{
10447
-
b, err := cr.ReadByte()
10448
-
if err != nil {
10449
-
return err
10450
-
}
10451
-
if b != cbg.CborNull[0] {
10452
-
if err := cr.UnreadByte(); err != nil {
10453
-
return err
10454
-
}
10455
-
10456
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10457
-
if err != nil {
10458
-
return err
10459
-
}
10460
-
10461
-
t.RepoDid = (*string)(&sval)
10462
-
}
10463
-
}
10464
10312
10465
10313
default:
10466
10314
// Field doesn't exist on this type, so ignore it
+93
-4
api/tangled/feedstar.go
+93
-4
api/tangled/feedstar.go
···
5
5
// schema: sh.tangled.feed.star
6
6
7
7
import (
8
+
"bytes"
9
+
"encoding/json"
10
+
"fmt"
11
+
"io"
12
+
8
13
"github.com/bluesky-social/indigo/lex/util"
14
+
cbg "github.com/whyrusleeping/cbor-gen"
9
15
)
10
16
11
17
const (
···
17
23
} //
18
24
// RECORDTYPE: FeedStar
19
25
type FeedStar struct {
20
-
LexiconTypeID string `json:"$type,const=sh.tangled.feed.star" cborgen:"$type,const=sh.tangled.feed.star"`
21
-
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
22
-
Subject *string `json:"subject,omitempty" cborgen:"subject,omitempty"`
23
-
SubjectDid *string `json:"subjectDid,omitempty" cborgen:"subjectDid,omitempty"`
26
+
LexiconTypeID string `json:"$type,const=sh.tangled.feed.star" cborgen:"$type,const=sh.tangled.feed.star"`
27
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
28
+
Subject *FeedStar_Subject `json:"subject" cborgen:"subject"`
29
+
}
30
+
31
+
// FeedStar_Repo is a "repo" in the sh.tangled.feed.star schema.
32
+
//
33
+
// RECORDTYPE: FeedStar_Repo
34
+
type FeedStar_Repo struct {
35
+
LexiconTypeID string `json:"$type,const=sh.tangled.feed.star#repo" cborgen:"$type,const=sh.tangled.feed.star#repo"`
36
+
Did string `json:"did" cborgen:"did"`
37
+
}
38
+
39
+
// FeedStar_String is a "string" in the sh.tangled.feed.star schema.
40
+
//
41
+
// RECORDTYPE: FeedStar_String
42
+
type FeedStar_String struct {
43
+
LexiconTypeID string `json:"$type,const=sh.tangled.feed.star#string" cborgen:"$type,const=sh.tangled.feed.star#string"`
44
+
Uri string `json:"uri" cborgen:"uri"`
45
+
}
46
+
47
+
type FeedStar_Subject struct {
48
+
FeedStar_Repo *FeedStar_Repo
49
+
FeedStar_String *FeedStar_String
50
+
}
51
+
52
+
func (t *FeedStar_Subject) MarshalJSON() ([]byte, error) {
53
+
if t.FeedStar_Repo != nil {
54
+
t.FeedStar_Repo.LexiconTypeID = "sh.tangled.feed.star#repo"
55
+
return json.Marshal(t.FeedStar_Repo)
56
+
}
57
+
if t.FeedStar_String != nil {
58
+
t.FeedStar_String.LexiconTypeID = "sh.tangled.feed.star#string"
59
+
return json.Marshal(t.FeedStar_String)
60
+
}
61
+
return nil, fmt.Errorf("cannot marshal empty enum")
62
+
}
63
+
func (t *FeedStar_Subject) UnmarshalJSON(b []byte) error {
64
+
typ, err := util.TypeExtract(b)
65
+
if err != nil {
66
+
return err
67
+
}
68
+
69
+
switch typ {
70
+
case "sh.tangled.feed.star#repo":
71
+
t.FeedStar_Repo = new(FeedStar_Repo)
72
+
return json.Unmarshal(b, t.FeedStar_Repo)
73
+
case "sh.tangled.feed.star#string":
74
+
t.FeedStar_String = new(FeedStar_String)
75
+
return json.Unmarshal(b, t.FeedStar_String)
76
+
77
+
default:
78
+
return fmt.Errorf("closed enums must have a matching value")
79
+
}
80
+
}
81
+
82
+
func (t *FeedStar_Subject) MarshalCBOR(w io.Writer) error {
83
+
84
+
if t == nil {
85
+
_, err := w.Write(cbg.CborNull)
86
+
return err
87
+
}
88
+
if t.FeedStar_Repo != nil {
89
+
return t.FeedStar_Repo.MarshalCBOR(w)
90
+
}
91
+
if t.FeedStar_String != nil {
92
+
return t.FeedStar_String.MarshalCBOR(w)
93
+
}
94
+
return fmt.Errorf("cannot cbor marshal empty enum")
95
+
}
96
+
func (t *FeedStar_Subject) UnmarshalCBOR(r io.Reader) error {
97
+
typ, b, err := util.CborTypeExtractReader(r)
98
+
if err != nil {
99
+
return err
100
+
}
101
+
102
+
switch typ {
103
+
case "sh.tangled.feed.star#repo":
104
+
t.FeedStar_Repo = new(FeedStar_Repo)
105
+
return t.FeedStar_Repo.UnmarshalCBOR(bytes.NewReader(b))
106
+
case "sh.tangled.feed.star#string":
107
+
t.FeedStar_String = new(FeedStar_String)
108
+
return t.FeedStar_String.UnmarshalCBOR(bytes.NewReader(b))
109
+
110
+
default:
111
+
return fmt.Errorf("closed enums must have a matching value")
112
+
}
24
113
}
+2
-4
api/tangled/gitrefUpdate.go
+2
-4
api/tangled/gitrefUpdate.go
···
29
29
OwnerDid *string `json:"ownerDid,omitempty" cborgen:"ownerDid,omitempty"`
30
30
// ref: Ref being updated
31
31
Ref string `json:"ref" cborgen:"ref"`
32
-
// repoDid: DID of the repo itself
33
-
RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"`
34
-
// repoName: name of the repo
35
-
RepoName string `json:"repoName" cborgen:"repoName"`
32
+
// repo: DID of the repo itself
33
+
Repo string `json:"repo" cborgen:"repo"`
36
34
}
37
35
38
36
// GitRefUpdate_CommitCountBreakdown is a "commitCountBreakdown" in the sh.tangled.git.refUpdate schema.
+3
-4
api/tangled/repocollaborator.go
+3
-4
api/tangled/repocollaborator.go
···
19
19
type RepoCollaborator struct {
20
20
LexiconTypeID string `json:"$type,const=sh.tangled.repo.collaborator" cborgen:"$type,const=sh.tangled.repo.collaborator"`
21
21
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
22
-
// repo: repo to add this user to
23
-
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
24
-
RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"`
25
-
Subject string `json:"subject" cborgen:"subject"`
22
+
// repo: repo DID to add this user to
23
+
Repo string `json:"repo" cborgen:"repo"`
24
+
Subject string `json:"subject" cborgen:"subject"`
26
25
}
+1
-2
api/tangled/repoissue.go
+1
-2
api/tangled/repoissue.go
···
22
22
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
23
23
Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"`
24
24
References []string `json:"references,omitempty" cborgen:"references,omitempty"`
25
-
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
26
-
RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"`
25
+
Repo string `json:"repo" cborgen:"repo"`
27
26
Title string `json:"title" cborgen:"title"`
28
27
}
+4
-6
api/tangled/repopull.go
+4
-6
api/tangled/repopull.go
···
39
39
40
40
// RepoPull_Source is a "source" in the sh.tangled.repo.pull schema.
41
41
type RepoPull_Source struct {
42
-
Branch string `json:"branch" cborgen:"branch"`
43
-
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
44
-
RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"`
42
+
Branch string `json:"branch" cborgen:"branch"`
43
+
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
45
44
}
46
45
47
46
// RepoPull_Target is a "target" in the sh.tangled.repo.pull schema.
48
47
type RepoPull_Target struct {
49
-
Branch string `json:"branch" cborgen:"branch"`
50
-
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
51
-
RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"`
48
+
Branch string `json:"branch" cborgen:"branch"`
49
+
Repo string `json:"repo" cborgen:"repo"`
52
50
}
+2
-2
api/tangled/tangledrepo.go
+2
-2
api/tangled/tangledrepo.go
···
24
24
Knot string `json:"knot" cborgen:"knot"`
25
25
// labels: List of labels that this repo subscribes to
26
26
Labels []string `json:"labels,omitempty" cborgen:"labels,omitempty"`
27
-
// name: name of the repo
28
-
Name string `json:"name" cborgen:"name"`
27
+
// name: Cosmetic name of the repo.
28
+
Name *string `json:"name,omitempty" cborgen:"name,omitempty"`
29
29
// repoDid: DID of the repo itself, if assigned
30
30
RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"`
31
31
// source: source of the repo
+2
cmd/cborgen/cborgen.go
+2
cmd/cborgen/cborgen.go
+1
-2
knotserver/xrpc/merge.go
+1
-2
knotserver/xrpc/merge.go
+24
-6
lexicons/feed/star.json
+24
-6
lexicons/feed/star.json
···
10
10
"record": {
11
11
"type": "object",
12
12
"required": [
13
+
"subject",
13
14
"createdAt"
14
15
],
15
16
"properties": {
16
17
"subject": {
17
-
"type": "string",
18
-
"format": "at-uri"
19
-
},
20
-
"subjectDid": {
21
-
"type": "string",
22
-
"format": "did"
18
+
"type": "union",
19
+
"refs": ["#repo", "#string"],
20
+
"closed": true
23
21
},
24
22
"createdAt": {
25
23
"type": "string",
···
27
25
}
28
26
}
29
27
}
28
+
},
29
+
"repo": {
30
+
"type": "object",
31
+
"required": ["did"],
32
+
"properties": {
33
+
"did": {
34
+
"type": "string",
35
+
"format": "did"
36
+
}
37
+
}
38
+
},
39
+
"string": {
40
+
"type": "object",
41
+
"required": ["uri"],
42
+
"properties": {
43
+
"uri": {
44
+
"type": "string",
45
+
"format": "at-uri"
46
+
}
47
+
}
30
48
}
31
49
}
32
50
}
+2
-6
lexicons/git/refUpdate.json
+2
-6
lexicons/git/refUpdate.json
···
11
11
"required": [
12
12
"ref",
13
13
"committerDid",
14
-
"repoName",
14
+
"repo",
15
15
"oldSha",
16
16
"newSha",
17
17
"meta"
···
33
33
"description": "did of the owner of the repo",
34
34
"format": "did"
35
35
},
36
-
"repoDid": {
36
+
"repo": {
37
37
"type": "string",
38
38
"description": "DID of the repo itself",
39
39
"format": "did"
40
40
},
41
-
"repoName": {
42
-
"type": "string",
43
-
"description": "name of the repo"
44
-
},
45
41
"oldSha": {
46
42
"type": "string",
47
43
"description": "old SHA of this ref",
+1
-5
lexicons/issue/issue.json
+1
-5
lexicons/issue/issue.json
···
9
9
"key": "tid",
10
10
"record": {
11
11
"type": "object",
12
-
"required": ["title", "createdAt"],
12
+
"required": ["repo", "title", "createdAt"],
13
13
"properties": {
14
14
"repo": {
15
-
"type": "string",
16
-
"format": "at-uri"
17
-
},
18
-
"repoDid": {
19
15
"type": "string",
20
16
"format": "did"
21
17
},
+1
-8
lexicons/pulls/pull.json
+1
-8
lexicons/pulls/pull.json
···
65
65
"target": {
66
66
"type": "object",
67
67
"required": [
68
+
"repo",
68
69
"branch"
69
70
],
70
71
"properties": {
71
72
"repo": {
72
-
"type": "string",
73
-
"format": "at-uri"
74
-
},
75
-
"repoDid": {
76
73
"type": "string",
77
74
"format": "did"
78
75
},
···
91
88
"type": "string"
92
89
},
93
90
"repo": {
94
-
"type": "string",
95
-
"format": "at-uri"
96
-
},
97
-
"repoDid": {
98
91
"type": "string",
99
92
"format": "did"
100
93
}
+2
-5
lexicons/repo/collaborator.json
+2
-5
lexicons/repo/collaborator.json
···
11
11
"type": "object",
12
12
"required": [
13
13
"subject",
14
+
"repo",
14
15
"createdAt"
15
16
],
16
17
"properties": {
···
20
21
},
21
22
"repo": {
22
23
"type": "string",
23
-
"description": "repo to add this user to",
24
-
"format": "at-uri"
25
-
},
26
-
"repoDid": {
27
-
"type": "string",
24
+
"description": "repo DID to add this user to",
28
25
"format": "did"
29
26
},
30
27
"createdAt": {
+2
-3
lexicons/repo/repo.json
+2
-3
lexicons/repo/repo.json
···
6
6
"defs": {
7
7
"main": {
8
8
"type": "record",
9
-
"key": "tid",
9
+
"key": "any",
10
10
"record": {
11
11
"type": "object",
12
12
"required": [
13
-
"name",
14
13
"knot",
15
14
"createdAt"
16
15
],
17
16
"properties": {
18
17
"name": {
19
18
"type": "string",
20
-
"description": "name of the repo"
19
+
"description": "Cosmetic name of the repo."
21
20
},
22
21
"knot": {
23
22
"type": "string",
History
9 rounds
0 comments
oyster.cafe
submitted
#8
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
merge conflicts detected
expand
collapse
expand
collapse
- api/tangled/cbor_gen.go:866
- api/tangled/feedstar.go:5
- api/tangled/gitrefUpdate.go:29
- api/tangled/repocollaborator.go:19
- api/tangled/repoissue.go:22
- api/tangled/repopull.go:39
- api/tangled/tangledrepo.go:24
- cmd/cborgen/cborgen.go:17
- knotserver/xrpc/merge.go:118
- lexicons/feed/star.json:10
- lexicons/git/refUpdate.json:11
- lexicons/issue/issue.json:9
- lexicons/pulls/pull.json:65
- lexicons/repo/collaborator.json:11
- lexicons/repo/repo.json:6
expand 0 comments
oyster.cafe
submitted
#7
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#6
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#5
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#4
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#3
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#2
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#1
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#0
1 commit
expand
collapse
lexicons,api: migrate stars+issues+pulls+collabs to repoDID
Lewis: May this revision serve well! <lewis@tangled.org>