aeharding / aeharding/threadiverse

Re-check JSON null normalization in lemmyv1 adapter

Offen
#34 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
7
Forks
1
Ø Merge
13 Min.
Gemergte PRs (30 T.)
1

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.