Skip to content

Incorrect type in Zod schema causing issues for /status/sessions endpoint #37

Description

@DominicFichera

https://github.com/LukeHagar/plexjs/blob/03910be91fd278a70695462cc9aeefe16971b2ec/src/sdk/models/shared/tag.ts#L25

A number of the types in the Zod schema don't match the actual response provided by the Plex API response to the /status/sessions endpoint, and as a result, Zod is throwing an error and not returning response.

Currently running Plex version: 4.147.1

Full URL: http://127.0.0.1:32400/status/sessions

  const plexAPI = new PlexAPI({
    token: "xxxxxxxx",
    accepts: Accepts.ApplicationJson,
    clientIdentifier: "xxxxxxx",
    serverURL: "http://127.0.0.1:32400",
  });
  plexAPI.status.listSessions({}).then((res) => console.log(res));
{
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [
      "object",
      "MediaContainer",
      "Metadata",
      0,
      "Director",
      0,
      "id"
    ],
    "message": "Expected number, received string"
  }
{
    "code": "invalid_type",
    "expected": "boolean",
    "received": "string",
    "path": [
      "object",
      "MediaContainer",
      "Metadata",
      0,
      "Media",
      0,
      "hasVoiceActivity"
    ],
    "message": "Expected boolean, received string"
  }
Image Image

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions