Skip to content

fix(api): mark response fields the live API can omit or null as nullish - #1102

Draft
michaldrabik wants to merge 1 commit into
masterfrom
fix/api-response-nullability
Draft

michaldrabik wants to merge 1 commit into
masterfrom
fix/api-response-nullability

Conversation

@michaldrabik

@michaldrabik michaldrabik commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Five response fields were typed stricter than what the live API returns, so a valid response failed to parse or was mistyped.

  • Settings user.email: now nullish. The API can leave it out.
  • Recommendations favorited_by / recommended_by: .nullable() -> .nullish() for movies and shows. The keys are not always present.
  • Season first_aired: .optional() -> .nullish(). It is null for seasons without an air date. The doc comment that sat inside .optional(...) moves above updated_at, the field it describes.
  • Progress reset_at: was z.null(), now a nullish UTC datetime. It holds a datetime while a rewatch is in progress.
  • Remove ratings not_found: now the ids-only mediaItemsNotFoundSchema. A remove request carries no rating, so the echo cannot have one, yet the previous schema required it.

Type changes

All changes loosen response types. Code that reads these fields as non-null needs a null check after upgrading:

  • email in settings: string -> string | null | undefined
  • favorited_by / recommended_by: T[] | null -> T[] | null | undefined
  • season first_aired: string | undefined -> string | null | undefined
  • reset_at: null -> string | null | undefined
  • remove ratings not_found entries: rating and rated_at are gone, ids is optional

No version bump in this PR.

Test plan

  • cd projects/api && bun run check
  • cd projects/api && bun run test
  • bun run lint and bun run format:check
  • bun run openapi:validate

@michaldrabik
michaldrabik force-pushed the fix/api-response-nullability branch from e30966e to 01cb6f6 Compare November 23, 2026 07:29
Five response fields were typed stricter than what the live API returns:

- settings user.email can be absent
- favorited_by and recommended_by on recommendations can be absent
- season first_aired is null for seasons without an air date
- progress reset_at holds a datetime while a rewatch is in progress
- remove ratings not_found echoes ids only, never a rating
@michaldrabik
michaldrabik force-pushed the fix/api-response-nullability branch from 01cb6f6 to 62f0d6c Compare November 30, 2026 07:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant