aeharding / aeharding/threadiverse

Re-check JSON null normalization in lemmyv1 adapter

Aperta
#34 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
7
Fork
1
Merge medio
13m
PR unite (30g)
1

Descrizione

The lemmyv1 adapter currently normalizes JSON `null` to `undefined` in a few places because the Lemmy 1.0 beta wire format returns `null` for absent optional fields rather than omitting them.

- `nullToUndef` helper used on `notification.{comment_id,modlog_id,post_id,private_message_id}` (`src/providers/lemmyv1/compat.ts:196-199`)
- `== null` (instead of `=== undefined`) checks against `PostActions.{vote_is_upvote,read_comments_at}` (`src/providers/lemmyv1/compat.ts:270,289`)

These workarounds papered over schemas that expect `undefined`. Once Lemmy stabilizes 1.0, recheck whether the server actually emits `null` for these fields and either:

1. Update our schemas to accept `null` explicitly (`z.nullish`) and drop the helpers, or
2. Confirm the server omits the fields and remove the normalization.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.