Lewis: May this revision serve well! lewis@tangled.org
+553
-622
Diff
round #8
+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
869
871
-
if t.Subject == nil {
872
-
fieldCount--
873
-
}
874
-
875
-
if t.SubjectDid == nil {
876
-
fieldCount--
877
-
}
878
-
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
···
6518
6642
fieldCount--
6519
6643
}
6520
6644
6645
+
if t.Name == nil {
6646
+
fieldCount--
6647
+
}
6648
+
6521
6649
if t.RepoDid == nil {
6522
6650
fieldCount--
6523
6651
}
···
6566
6694
}
6567
6695
6568
6696
// t.Name (string) (string)
6569
-
if len("name") > 1000000 {
6570
-
return xerrors.Errorf("Value in field \"name\" was too long")
6571
-
}
6697
+
if t.Name != nil {
6572
6698
6573
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
6574
-
return err
6575
-
}
6576
-
if _, err := cw.WriteString(string("name")); err != nil {
6577
-
return err
6578
-
}
6699
+
if len("name") > 1000000 {
6700
+
return xerrors.Errorf("Value in field \"name\" was too long")
6701
+
}
6579
6702
6580
-
if len(t.Name) > 1000000 {
6581
-
return xerrors.Errorf("Value in field t.Name was too long")
6582
-
}
6703
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
6704
+
return err
6705
+
}
6706
+
if _, err := cw.WriteString(string("name")); err != nil {
6707
+
return err
6708
+
}
6583
6709
6584
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
6585
-
return err
6586
-
}
6587
-
if _, err := cw.WriteString(string(t.Name)); err != nil {
6588
-
return err
6710
+
if t.Name == nil {
6711
+
if _, err := cw.Write(cbg.CborNull); err != nil {
6712
+
return err
6713
+
}
6714
+
} else {
6715
+
if len(*t.Name) > 1000000 {
6716
+
return xerrors.Errorf("Value in field t.Name was too long")
6717
+
}
6718
+
6719
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Name))); err != nil {
6720
+
return err
6721
+
}
6722
+
if _, err := cw.WriteString(string(*t.Name)); err != nil {
6723
+
return err
6724
+
}
6725
+
}
6589
6726
}
6590
6727
6591
6728
// t.LexiconTypeID (string) (string)
···
6920
7057
case "name":
6921
7058
6922
7059
{
6923
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7060
+
b, err := cr.ReadByte()
6924
7061
if err != nil {
6925
7062
return err
6926
7063
}
7064
+
if b != cbg.CborNull[0] {
7065
+
if err := cr.UnreadByte(); err != nil {
7066
+
return err
7067
+
}
6927
7068
6928
-
t.Name = string(sval)
7069
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7070
+
if err != nil {
7071
+
return err
7072
+
}
7073
+
7074
+
t.Name = (*string)(&sval)
7075
+
}
6929
7076
}
6930
7077
// t.LexiconTypeID (string) (string)
6931
7078
case "$type":
···
7522
7669
}
7523
7670
7524
7671
cw := cbg.NewCborWriter(w)
7525
-
fieldCount := 5
7526
7672
7527
-
if t.Repo == nil {
7528
-
fieldCount--
7673
+
if _, err := cw.Write([]byte{164}); err != nil {
7674
+
return err
7529
7675
}
7530
7676
7531
-
if t.RepoDid == nil {
7532
-
fieldCount--
7677
+
// t.Repo (string) (string)
7678
+
if len("repo") > 1000000 {
7679
+
return xerrors.Errorf("Value in field \"repo\" was too long")
7533
7680
}
7534
7681
7535
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
7682
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7683
+
return err
7684
+
}
7685
+
if _, err := cw.WriteString(string("repo")); err != nil {
7536
7686
return err
7537
7687
}
7538
7688
7539
-
// t.Repo (string) (string)
7540
-
if t.Repo != nil {
7541
-
7542
-
if len("repo") > 1000000 {
7543
-
return xerrors.Errorf("Value in field \"repo\" was too long")
7544
-
}
7545
-
7546
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7547
-
return err
7548
-
}
7549
-
if _, err := cw.WriteString(string("repo")); err != nil {
7550
-
return err
7551
-
}
7552
-
7553
-
if t.Repo == nil {
7554
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7555
-
return err
7556
-
}
7557
-
} else {
7558
-
if len(*t.Repo) > 1000000 {
7559
-
return xerrors.Errorf("Value in field t.Repo was too long")
7560
-
}
7689
+
if len(t.Repo) > 1000000 {
7690
+
return xerrors.Errorf("Value in field t.Repo was too long")
7691
+
}
7561
7692
7562
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
7563
-
return err
7564
-
}
7565
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
7566
-
return err
7567
-
}
7568
-
}
7693
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
7694
+
return err
7695
+
}
7696
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
7697
+
return err
7569
7698
}
7570
7699
7571
7700
// t.LexiconTypeID (string) (string)
···
7587
7716
return err
7588
7717
}
7589
7718
7590
-
// t.RepoDid (string) (string)
7591
-
if t.RepoDid != nil {
7592
-
7593
-
if len("repoDid") > 1000000 {
7594
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
7595
-
}
7596
-
7597
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
7598
-
return err
7599
-
}
7600
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
7601
-
return err
7602
-
}
7603
-
7604
-
if t.RepoDid == nil {
7605
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7606
-
return err
7607
-
}
7608
-
} else {
7609
-
if len(*t.RepoDid) > 1000000 {
7610
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
7611
-
}
7612
-
7613
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
7614
-
return err
7615
-
}
7616
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
7617
-
return err
7618
-
}
7619
-
}
7620
-
}
7621
-
7622
7719
// t.Subject (string) (string)
7623
7720
if len("subject") > 1000000 {
7624
7721
return xerrors.Errorf("Value in field \"subject\" was too long")
···
7712
7809
case "repo":
7713
7810
7714
7811
{
7715
-
b, err := cr.ReadByte()
7812
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7716
7813
if err != nil {
7717
7814
return err
7718
7815
}
7719
-
if b != cbg.CborNull[0] {
7720
-
if err := cr.UnreadByte(); err != nil {
7721
-
return err
7722
-
}
7723
-
7724
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7725
-
if err != nil {
7726
-
return err
7727
-
}
7728
7816
7729
-
t.Repo = (*string)(&sval)
7730
-
}
7817
+
t.Repo = string(sval)
7731
7818
}
7732
7819
// t.LexiconTypeID (string) (string)
7733
7820
case "$type":
···
7740
7827
7741
7828
t.LexiconTypeID = string(sval)
7742
7829
}
7743
-
// t.RepoDid (string) (string)
7744
-
case "repoDid":
7745
-
7746
-
{
7747
-
b, err := cr.ReadByte()
7748
-
if err != nil {
7749
-
return err
7750
-
}
7751
-
if b != cbg.CborNull[0] {
7752
-
if err := cr.UnreadByte(); err != nil {
7753
-
return err
7754
-
}
7755
-
7756
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7757
-
if err != nil {
7758
-
return err
7759
-
}
7760
-
7761
-
t.RepoDid = (*string)(&sval)
7762
-
}
7763
-
}
7764
7830
// t.Subject (string) (string)
7765
7831
case "subject":
7766
7832
···
7801
7867
}
7802
7868
7803
7869
cw := cbg.NewCborWriter(w)
7804
-
fieldCount := 8
7870
+
fieldCount := 7
7805
7871
7806
7872
if t.Body == nil {
7807
7873
fieldCount--
···
7815
7881
fieldCount--
7816
7882
}
7817
7883
7818
-
if t.Repo == nil {
7819
-
fieldCount--
7820
-
}
7821
-
7822
-
if t.RepoDid == nil {
7823
-
fieldCount--
7824
-
}
7825
-
7826
7884
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
7827
7885
return err
7828
7886
}
···
7860
7918
}
7861
7919
7862
7920
// t.Repo (string) (string)
7863
-
if t.Repo != nil {
7864
-
7865
-
if len("repo") > 1000000 {
7866
-
return xerrors.Errorf("Value in field \"repo\" was too long")
7867
-
}
7868
-
7869
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7870
-
return err
7871
-
}
7872
-
if _, err := cw.WriteString(string("repo")); err != nil {
7873
-
return err
7874
-
}
7921
+
if len("repo") > 1000000 {
7922
+
return xerrors.Errorf("Value in field \"repo\" was too long")
7923
+
}
7875
7924
7876
-
if t.Repo == nil {
7877
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7878
-
return err
7879
-
}
7880
-
} else {
7881
-
if len(*t.Repo) > 1000000 {
7882
-
return xerrors.Errorf("Value in field t.Repo was too long")
7883
-
}
7925
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7926
+
return err
7927
+
}
7928
+
if _, err := cw.WriteString(string("repo")); err != nil {
7929
+
return err
7930
+
}
7884
7931
7885
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
7886
-
return err
7887
-
}
7888
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
7889
-
return err
7890
-
}
7891
-
}
7932
+
if len(t.Repo) > 1000000 {
7933
+
return xerrors.Errorf("Value in field t.Repo was too long")
7934
+
}
7935
+
7936
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
7937
+
return err
7938
+
}
7939
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
7940
+
return err
7892
7941
}
7893
7942
7894
7943
// t.LexiconTypeID (string) (string)
···
7933
7982
return err
7934
7983
}
7935
7984
7936
-
// t.RepoDid (string) (string)
7937
-
if t.RepoDid != nil {
7938
-
7939
-
if len("repoDid") > 1000000 {
7940
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
7941
-
}
7942
-
7943
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
7944
-
return err
7945
-
}
7946
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
7947
-
return err
7948
-
}
7949
-
7950
-
if t.RepoDid == nil {
7951
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7952
-
return err
7953
-
}
7954
-
} else {
7955
-
if len(*t.RepoDid) > 1000000 {
7956
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
7957
-
}
7958
-
7959
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
7960
-
return err
7961
-
}
7962
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
7963
-
return err
7964
-
}
7965
-
}
7966
-
}
7967
-
7968
7985
// t.Mentions ([]string) (slice)
7969
7986
if t.Mentions != nil {
7970
7987
···
8128
8145
case "repo":
8129
8146
8130
8147
{
8131
-
b, err := cr.ReadByte()
8148
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
8132
8149
if err != nil {
8133
8150
return err
8134
8151
}
8135
-
if b != cbg.CborNull[0] {
8136
-
if err := cr.UnreadByte(); err != nil {
8137
-
return err
8138
-
}
8139
-
8140
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
8141
-
if err != nil {
8142
-
return err
8143
-
}
8144
8152
8145
-
t.Repo = (*string)(&sval)
8146
-
}
8153
+
t.Repo = string(sval)
8147
8154
}
8148
8155
// t.LexiconTypeID (string) (string)
8149
8156
case "$type":
···
8167
8174
8168
8175
t.Title = string(sval)
8169
8176
}
8170
-
// t.RepoDid (string) (string)
8171
-
case "repoDid":
8172
-
8173
-
{
8174
-
b, err := cr.ReadByte()
8175
-
if err != nil {
8176
-
return err
8177
-
}
8178
-
if b != cbg.CborNull[0] {
8179
-
if err := cr.UnreadByte(); err != nil {
8180
-
return err
8181
-
}
8182
-
8183
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
8184
-
if err != nil {
8185
-
return err
8186
-
}
8187
-
8188
-
t.RepoDid = (*string)(&sval)
8189
-
}
8190
-
}
8191
8177
// t.Mentions ([]string) (slice)
8192
8178
case "mentions":
8193
8179
···
9965
9951
}
9966
9952
9967
9953
cw := cbg.NewCborWriter(w)
9968
-
fieldCount := 3
9954
+
fieldCount := 2
9969
9955
9970
9956
if t.Repo == nil {
9971
9957
fieldCount--
9972
9958
}
9973
9959
9974
-
if t.RepoDid == nil {
9975
-
fieldCount--
9976
-
}
9977
-
9978
9960
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
9979
9961
return err
9980
9962
}
···
10033
10015
if _, err := cw.WriteString(string(t.Branch)); err != nil {
10034
10016
return err
10035
10017
}
10036
-
10037
-
// t.RepoDid (string) (string)
10038
-
if t.RepoDid != nil {
10039
-
10040
-
if len("repoDid") > 1000000 {
10041
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
10042
-
}
10043
-
10044
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
10045
-
return err
10046
-
}
10047
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
10048
-
return err
10049
-
}
10050
-
10051
-
if t.RepoDid == nil {
10052
-
if _, err := cw.Write(cbg.CborNull); err != nil {
10053
-
return err
10054
-
}
10055
-
} else {
10056
-
if len(*t.RepoDid) > 1000000 {
10057
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
10058
-
}
10059
-
10060
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
10061
-
return err
10062
-
}
10063
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
10064
-
return err
10065
-
}
10066
-
}
10067
-
}
10068
10018
return nil
10069
10019
}
10070
10020
···
10093
10043
10094
10044
n := extra
10095
10045
10096
-
nameBuf := make([]byte, 7)
10046
+
nameBuf := make([]byte, 6)
10097
10047
for i := uint64(0); i < n; i++ {
10098
10048
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
10099
10049
if err != nil {
···
10141
10091
10142
10092
t.Branch = string(sval)
10143
10093
}
10144
-
// t.RepoDid (string) (string)
10145
-
case "repoDid":
10146
-
10147
-
{
10148
-
b, err := cr.ReadByte()
10149
-
if err != nil {
10150
-
return err
10151
-
}
10152
-
if b != cbg.CborNull[0] {
10153
-
if err := cr.UnreadByte(); err != nil {
10154
-
return err
10155
-
}
10156
-
10157
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10158
-
if err != nil {
10159
-
return err
10160
-
}
10161
-
10162
-
t.RepoDid = (*string)(&sval)
10163
-
}
10164
-
}
10165
10094
10166
10095
default:
10167
10096
// Field doesn't exist on this type, so ignore it
···
10344
10273
}
10345
10274
10346
10275
cw := cbg.NewCborWriter(w)
10347
-
fieldCount := 3
10348
10276
10349
-
if t.Repo == nil {
10350
-
fieldCount--
10277
+
if _, err := cw.Write([]byte{162}); err != nil {
10278
+
return err
10351
10279
}
10352
10280
10353
-
if t.RepoDid == nil {
10354
-
fieldCount--
10281
+
// t.Repo (string) (string)
10282
+
if len("repo") > 1000000 {
10283
+
return xerrors.Errorf("Value in field \"repo\" was too long")
10355
10284
}
10356
10285
10357
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
10286
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
10287
+
return err
10288
+
}
10289
+
if _, err := cw.WriteString(string("repo")); err != nil {
10358
10290
return err
10359
10291
}
10360
10292
10361
-
// t.Repo (string) (string)
10362
-
if t.Repo != nil {
10363
-
10364
-
if len("repo") > 1000000 {
10365
-
return xerrors.Errorf("Value in field \"repo\" was too long")
10366
-
}
10367
-
10368
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
10369
-
return err
10370
-
}
10371
-
if _, err := cw.WriteString(string("repo")); err != nil {
10372
-
return err
10373
-
}
10374
-
10375
-
if t.Repo == nil {
10376
-
if _, err := cw.Write(cbg.CborNull); err != nil {
10377
-
return err
10378
-
}
10379
-
} else {
10380
-
if len(*t.Repo) > 1000000 {
10381
-
return xerrors.Errorf("Value in field t.Repo was too long")
10382
-
}
10293
+
if len(t.Repo) > 1000000 {
10294
+
return xerrors.Errorf("Value in field t.Repo was too long")
10295
+
}
10383
10296
10384
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
10385
-
return err
10386
-
}
10387
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
10388
-
return err
10389
-
}
10390
-
}
10297
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
10298
+
return err
10299
+
}
10300
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
10301
+
return err
10391
10302
}
10392
10303
10393
10304
// t.Branch (string) (string)
···
10412
10323
if _, err := cw.WriteString(string(t.Branch)); err != nil {
10413
10324
return err
10414
10325
}
10415
-
10416
-
// t.RepoDid (string) (string)
10417
-
if t.RepoDid != nil {
10418
-
10419
-
if len("repoDid") > 1000000 {
10420
-
return xerrors.Errorf("Value in field \"repoDid\" was too long")
10421
-
}
10422
-
10423
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil {
10424
-
return err
10425
-
}
10426
-
if _, err := cw.WriteString(string("repoDid")); err != nil {
10427
-
return err
10428
-
}
10429
-
10430
-
if t.RepoDid == nil {
10431
-
if _, err := cw.Write(cbg.CborNull); err != nil {
10432
-
return err
10433
-
}
10434
-
} else {
10435
-
if len(*t.RepoDid) > 1000000 {
10436
-
return xerrors.Errorf("Value in field t.RepoDid was too long")
10437
-
}
10438
-
10439
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil {
10440
-
return err
10441
-
}
10442
-
if _, err := cw.WriteString(string(*t.RepoDid)); err != nil {
10443
-
return err
10444
-
}
10445
-
}
10446
-
}
10447
10326
return nil
10448
10327
}
10449
10328
···
10472
10351
10473
10352
n := extra
10474
10353
10475
-
nameBuf := make([]byte, 7)
10354
+
nameBuf := make([]byte, 6)
10476
10355
for i := uint64(0); i < n; i++ {
10477
10356
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
10478
10357
if err != nil {
···
10492
10371
case "repo":
10493
10372
10494
10373
{
10495
-
b, err := cr.ReadByte()
10374
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10496
10375
if err != nil {
10497
10376
return err
10498
10377
}
10499
-
if b != cbg.CborNull[0] {
10500
-
if err := cr.UnreadByte(); err != nil {
10501
-
return err
10502
-
}
10503
-
10504
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10505
-
if err != nil {
10506
-
return err
10507
-
}
10508
10378
10509
-
t.Repo = (*string)(&sval)
10510
-
}
10379
+
t.Repo = string(sval)
10511
10380
}
10512
10381
// t.Branch (string) (string)
10513
10382
case "branch":
···
10520
10389
10521
10390
t.Branch = string(sval)
10522
10391
}
10523
-
// t.RepoDid (string) (string)
10524
-
case "repoDid":
10525
-
10526
-
{
10527
-
b, err := cr.ReadByte()
10528
-
if err != nil {
10529
-
return err
10530
-
}
10531
-
if b != cbg.CborNull[0] {
10532
-
if err := cr.UnreadByte(); err != nil {
10533
-
return err
10534
-
}
10535
-
10536
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
10537
-
if err != nil {
10538
-
return err
10539
-
}
10540
-
10541
-
t.RepoDid = (*string)(&sval)
10542
-
}
10543
-
}
10544
10392
10545
10393
default:
10546
10394
// 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>