Skip to content

Whether GET does some parsing or not is not explicit #425

Open
@eric-burel

Description

@eric-burel

Path: /redis/sdks/py/commands/string/get

Hi, I've failed to assess whether get does parse JSON or not from the docs:

async function getSession(sessionId: string) {
  const redis = getRedis();
  const maybeSession = (await redis.get(getSessionKey(sessionId))) as
    | string
    | null;
  if (!maybeSession) {
    // first input
    return null;
  }
// "JSON.parse" here will raise an error as you can't parse again a JSON object
  return sessionSchema.parse(maybeSession);
}

The set method doc is more explicit about the fact that it handles the JSON.stringify call if it receives an object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions