porting all github actions from bluesky-social/indigo to tangled CI

lex: regenerate APIs, moving manual hacks into code generator (#138)

This way we can run "make lexgen" and not have to manually tweak the
output.

authored by Whyrusleeping and committed by GitHub 260ef5ca 9d6296d5

Changed files
+16 -4
api
lex
+1 -2
api/atproto/syncsubscribeRepos.go
··· 10 10 } 11 11 12 12 type SyncSubscribeRepos_Commit struct { 13 - Blobs []util.LexLink `json:"blobs" cborgen:"blobs"` 14 - // TODO: need to fix lexgen to make LexBytes 'omitempty'. This is currently being manually edited 13 + Blobs []util.LexLink `json:"blobs" cborgen:"blobs"` 15 14 Blocks util.LexBytes `json:"blocks,omitempty" cborgen:"blocks"` 16 15 Commit util.LexLink `json:"commit" cborgen:"commit"` 17 16 Ops []*SyncSubscribeRepos_RepoOp `json:"ops" cborgen:"ops"`
+1
api/bsky/embedrecord.go
··· 39 39 Cid string `json:"cid" cborgen:"cid"` 40 40 Embeds []*EmbedRecord_ViewRecord_Embeds_Elem `json:"embeds,omitempty" cborgen:"embeds,omitempty"` 41 41 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 42 + Labels []*comatprototypes.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` 42 43 Uri string `json:"uri" cborgen:"uri"` 43 44 Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 44 45 }
+14 -2
lex/gen.go
··· 1145 1145 fmt.Fprintf(w, "type %s struct {\n", name) 1146 1146 1147 1147 if ts.needsType { 1148 - fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,const=%s\" cborgen:\"$type,const=%s\"`\n", ts.id, ts.id) 1148 + var omit string 1149 + if ts.id == "com.atproto.repo.strongRef" { // TODO: hack 1150 + omit = ",omitempty" 1151 + } 1152 + fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,const=%s%s\" cborgen:\"$type,const=%s%s\"`\n", ts.id, omit, ts.id, omit) 1149 1153 } else { 1150 1154 //fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,omitempty\" cborgen:\"$type,omitempty\"`\n") 1151 1155 } ··· 1183 1187 } 1184 1188 } 1185 1189 1186 - fmt.Fprintf(w, "\t%s %s%s `json:\"%s%s\" cborgen:\"%s%s\"`\n", goname, ptr, tname, k, omit, k, omit) 1190 + jsonOmit, cborOmit := omit, omit 1191 + 1192 + // TODO: hard-coded hacks for now, making this type (with underlying type []byte) 1193 + // be omitempty. 1194 + if ptr == "" && tname == "util.LexBytes" { 1195 + jsonOmit = ",omitempty" 1196 + } 1197 + 1198 + fmt.Fprintf(w, "\t%s %s%s `json:\"%s%s\" cborgen:\"%s%s\"`\n", goname, ptr, tname, k, jsonOmit, k, cborOmit) 1187 1199 return nil 1188 1200 }); err != nil { 1189 1201 return err