All embed-bearing appview responses fail to deserialize — $type not first and AllowOutOfOrderMetadataProperties unset #50
Labels
No labels
breaking-change
bug
documentation
duplicate
enhancement
good first issue
help wanted
performance
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Grandiras/ATProto.NET#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
app.bsky.feed.getPosts/getPostThread/timeline responses from the public Bluesky appview serialize embed views with the discriminator LAST (property order:['external', '$type']). System.Text.Json's[JsonPolymorphic]requires the discriminator first unlessJsonSerializerOptions.AllowOutOfOrderMetadataProperties = true(.NET 9+), so every response containing an embed throws:Repro:
client.Bsky.Feed.GetPostsAsync(["at://did:plc:tkjlutt3jh2aqkkxliitff6k/app.bsky.feed.post/3m3micwvzml2b"])againsthttps://public.api.bsky.app.Fix: set
AllowOutOfOrderMetadataProperties = trueinAtProtoJsonDefaults.CreateOptions()andLexiconTypeRegistry.CreateOptions(). Real-world writers also put$typelast in record-internal unions (observed in exchange.recipe attribution objects), so this hardens record reads too. Found by Mise's engagement hydration (anchor share-post resolution silently failed).