atproto made easy crates.io/crates/jacquard

Single-variant unions serialize without `$type` #74

Open boltless.me
Open opened by boltless.me

If a union has only one ref, codegen uses the ref type directly instead of generating a union enum (codegen/types.rs:59 for array items, :123 for fields). Plain object defs aren't tagged, so $type never gets written.

"subject": { "type": "union", "refs": ["com.atproto.repo.strongRef"] }

generates pub subject: StrongRef<S>, which serializes as "subject": { "uri": "...", "cid": "..." } with no "$type": "com.atproto.repo.strongRef".

Example: https://pdsls.dev/at://did:plc:jj6ajj6duxnlthwtnob4qyuv/org.tangled.feed.comment/3mcph2ttzzo22

Sign up or Sign in to add to the discussion.