Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eric-burel opened this issue Mar 24, 2025 · 0 comments
Open

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

eric-burel opened this issue Mar 24, 2025 · 0 comments

Comments

@eric-burel
Copy link

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.

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

No branches or pull requests

1 participant