this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lexgen: slightly more robust 'unkown' handling (hack) (#448)

This is a bit more robust than the current situation where we manually
comment things out.

Just looks for the specific field names `didDoc` or `plcOp` and plops in
an `*interface{]` type instead for those.

Could also have done `*map[string]interface{}` but I was worried not
initializing that datatype; maybe unwarranted.

My assumption is that `json.RawMessage` would be best here for JSON
stuff, but that causes problems for CBOR stuff.

authored by

Whyrusleeping and committed by
GitHub
3e8c6300 51ad672b

+40 -38
+5 -6
api/atproto/repodescribeRepo.go
··· 7 7 import ( 8 8 "context" 9 9 10 - "github.com/bluesky-social/indigo/lex/util" 11 10 "github.com/bluesky-social/indigo/xrpc" 12 11 ) 13 12 14 13 // RepoDescribeRepo_Output is the output of a com.atproto.repo.describeRepo call. 15 14 type RepoDescribeRepo_Output struct { 16 - Collections []string `json:"collections" cborgen:"collections"` 17 - Did string `json:"did" cborgen:"did"` 18 - DidDoc *util.LexiconTypeDecoder `json:"didDoc" cborgen:"didDoc"` 19 - Handle string `json:"handle" cborgen:"handle"` 20 - HandleIsCorrect bool `json:"handleIsCorrect" cborgen:"handleIsCorrect"` 15 + Collections []string `json:"collections" cborgen:"collections"` 16 + Did string `json:"did" cborgen:"did"` 17 + DidDoc interface{} `json:"didDoc" cborgen:"didDoc"` 18 + Handle string `json:"handle" cborgen:"handle"` 19 + HandleIsCorrect bool `json:"handleIsCorrect" cborgen:"handleIsCorrect"` 21 20 } 22 21 23 22 // RepoDescribeRepo calls the XRPC method "com.atproto.repo.describeRepo".
+12 -13
api/atproto/servercreateAccount.go
··· 7 7 import ( 8 8 "context" 9 9 10 - "github.com/bluesky-social/indigo/lex/util" 11 10 "github.com/bluesky-social/indigo/xrpc" 12 11 ) 13 12 14 13 // ServerCreateAccount_Input is the input argument to a com.atproto.server.createAccount call. 15 14 type ServerCreateAccount_Input struct { 16 - Did *string `json:"did,omitempty" cborgen:"did,omitempty"` 17 - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 18 - Handle string `json:"handle" cborgen:"handle"` 19 - InviteCode *string `json:"inviteCode,omitempty" cborgen:"inviteCode,omitempty"` 20 - Password *string `json:"password,omitempty" cborgen:"password,omitempty"` 21 - PlcOp *util.LexiconTypeDecoder `json:"plcOp,omitempty" cborgen:"plcOp,omitempty"` 22 - RecoveryKey *string `json:"recoveryKey,omitempty" cborgen:"recoveryKey,omitempty"` 15 + Did *string `json:"did,omitempty" cborgen:"did,omitempty"` 16 + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 17 + Handle string `json:"handle" cborgen:"handle"` 18 + InviteCode *string `json:"inviteCode,omitempty" cborgen:"inviteCode,omitempty"` 19 + Password *string `json:"password,omitempty" cborgen:"password,omitempty"` 20 + PlcOp *interface{} `json:"plcOp,omitempty" cborgen:"plcOp,omitempty"` 21 + RecoveryKey *string `json:"recoveryKey,omitempty" cborgen:"recoveryKey,omitempty"` 23 22 } 24 23 25 24 // ServerCreateAccount_Output is the output of a com.atproto.server.createAccount call. 26 25 type ServerCreateAccount_Output struct { 27 - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 28 - Did string `json:"did" cborgen:"did"` 29 - DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 30 - Handle string `json:"handle" cborgen:"handle"` 31 - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 26 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 27 + Did string `json:"did" cborgen:"did"` 28 + DidDoc *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 29 + Handle string `json:"handle" cborgen:"handle"` 30 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 32 31 } 33 32 34 33 // ServerCreateAccount calls the XRPC method "com.atproto.server.createAccount".
+7 -7
api/atproto/servercreateSession.go
··· 19 19 20 20 // ServerCreateSession_Output is the output of a com.atproto.server.createSession call. 21 21 type ServerCreateSession_Output struct { 22 - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 23 - Did string `json:"did" cborgen:"did"` 24 - //DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 25 - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 26 - EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` 27 - Handle string `json:"handle" cborgen:"handle"` 28 - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 22 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 23 + Did string `json:"did" cborgen:"did"` 24 + DidDoc *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 25 + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 26 + EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` 27 + Handle string `json:"handle" cborgen:"handle"` 28 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 29 29 } 30 30 31 31 // ServerCreateSession calls the XRPC method "com.atproto.server.createSession".
+5 -6
api/atproto/servergetSession.go
··· 7 7 import ( 8 8 "context" 9 9 10 - "github.com/bluesky-social/indigo/lex/util" 11 10 "github.com/bluesky-social/indigo/xrpc" 12 11 ) 13 12 14 13 // ServerGetSession_Output is the output of a com.atproto.server.getSession call. 15 14 type ServerGetSession_Output struct { 16 - Did string `json:"did" cborgen:"did"` 17 - DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 18 - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 19 - EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` 20 - Handle string `json:"handle" cborgen:"handle"` 15 + Did string `json:"did" cborgen:"did"` 16 + DidDoc *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 17 + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 18 + EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` 19 + Handle string `json:"handle" cborgen:"handle"` 21 20 } 22 21 23 22 // ServerGetSession calls the XRPC method "com.atproto.server.getSession".
+5 -5
api/atproto/serverrefreshSession.go
··· 12 12 13 13 // ServerRefreshSession_Output is the output of a com.atproto.server.refreshSession call. 14 14 type ServerRefreshSession_Output struct { 15 - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 16 - Did string `json:"did" cborgen:"did"` 17 - //DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 18 - Handle string `json:"handle" cborgen:"handle"` 19 - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 15 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 16 + Did string `json:"did" cborgen:"did"` 17 + DidDoc *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` 18 + Handle string `json:"handle" cborgen:"handle"` 19 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 20 20 } 21 21 22 22 // ServerRefreshSession calls the XRPC method "com.atproto.server.refreshSession".
+6 -1
lex/gen.go
··· 1119 1119 // TODO: maybe do a native type? 1120 1120 return "string", nil 1121 1121 case "unknown": 1122 - return "*util.LexiconTypeDecoder", nil 1122 + // NOTE: sometimes a record, for which we want LexiconTypeDecoder, sometimes any object 1123 + if k == "didDoc" || k == "plcOp" { 1124 + return "interface{}", nil 1125 + } else { 1126 + return "*util.LexiconTypeDecoder", nil 1127 + } 1123 1128 case "union": 1124 1129 return "*" + name + "_" + strings.Title(k), nil 1125 1130 case "blob":