Skip to content

fix: allow null icon16x16 in display schema - #9

Open
nate-kelley-buster wants to merge 1 commit into
TheBestMoshe:mainfrom
nate-kelley-buster:fix/nullable-icon16x16-schema
Open

nate-kelley-buster wants to merge 1 commit into
TheBestMoshe:mainfrom
nate-kelley-buster:fix/nullable-icon16x16-schema

Conversation

@nate-kelley-buster

Copy link
Copy Markdown

Problem

yoto playlist show <cardId> (and anything else parsing card content through GetContentResponseSchema) throws a Zod validation error on any playlist containing chapters/tracks without a custom icon set:

[
  {
    "expected": "string",
    "code": "invalid_type",
    "path": ["card", "content", "chapters", 0, "display", "icon16x16"],
    "message": "Invalid input: expected string, received null"
  },
  ...
]

Root cause

The Yoto API returns display.icon16x16 as null (not omitted) when no custom icon is set. DisplaySchema only declared icon16x16: z.string().optional(), which accepts undefined but not null.

Fix

Add .nullable() to the icon16x16 field.

Verification

Reproduced against a real 25-chapter playlist (all chapters had null icon16x16) — playlist show failed before this change and renders correctly after it.

The Yoto API returns display.icon16x16 as null for chapters/tracks
that don't have a custom icon set, but DisplaySchema only allowed
string|undefined for that field. This made `playlist show` (and any
other command that parses card content) throw a Zod validation error
on any playlist with unset icons instead of rendering.

Verified against a real 25-chapter playlist that previously failed
to display.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0182auKxRRCcLdZrBotvbJ6K
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