this repo has no description
0
fork

Configure Feed

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

lexgen empty union (#1115)

This fixes lexgen for empty unions (which it now treats similarly to
`unknown`).

Also handles the special "meta" unknown field in
`tools.ozone.moderation.defs#modTool`, which is a "true" unknown (aka,
it will not have `$type`, similar to plc ops and did docs).

I tested running against atproto main, and the API part worked, but
current lexgen adds yet more params to queryEvents which breaks things.

authored by

bnewbold and committed by
GitHub
ef43ad32 0f305880

+7 -2
+7 -2
lex/type_schema.go
··· 552 552 return "string", nil 553 553 case "unknown": 554 554 // NOTE: sometimes a record, for which we want LexiconTypeDecoder, sometimes any object 555 - if k == "didDoc" || k == "plcOp" { 555 + if k == "didDoc" || k == "plcOp" || k == "meta" { 556 556 return "interface{}", nil 557 557 } else { 558 558 return "*util.LexiconTypeDecoder", nil 559 559 } 560 560 case "union": 561 - return "*" + name + "_" + strings.Title(k), nil 561 + if len(v.Refs) > 0 { 562 + return "*" + name + "_" + strings.Title(k), nil 563 + } else { 564 + // an empty union is effectively an 'unknown', but with mandatory type indicator 565 + return "*util.LexiconTypeDecoder", nil 566 + } 562 567 case "blob": 563 568 return "*util.LexBlob", nil 564 569 case "array":