Skip to content
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

pydantic.JsonValue is not assignable to prisma.types.Serizlizable #1061

Open
rijenkii opened this issue Jan 20, 2025 · 0 comments
Open

pydantic.JsonValue is not assignable to prisma.types.Serizlizable #1061

rijenkii opened this issue Jan 20, 2025 · 0 comments

Comments

@rijenkii
Copy link

Bug description

pydantic has its own type for parsing JSON: https://docs.pydantic.dev/latest/api/types/#pydantic.types.JsonValue.

Sadly it does not seem to be assignable to Serializable, so you cannot cleanly construct a prisma.Json object from it.

How to reproduce

import pydantic
import prisma


def return_json_value() -> pydantic.JsonValue:
    raise NotImplementedError()

b = prisma.Json(return_json_value())
Argument of type "JsonValue" cannot be assigned to parameter "data" of type "Serializable" in function "__init__"
  Type "JsonValue" is not assignable to type "Serializable"
    Type "Dict[str, JsonValue]" is not assignable to type "Serializable"
      "Dict[str, JsonValue]" is not assignable to "None"
      "Dict[str, JsonValue]" is not assignable to "bool"
      "Dict[str, JsonValue]" is not assignable to "float"
      "Dict[str, JsonValue]" is not assignable to "int"
      "Dict[str, JsonValue]" is not assignable to "str"
      "Dict[str, JsonValue]" is not assignable to "datetime"
  ...Pylance[reportArgumentType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportArgumentType)

Prisma information

N/A

Environment & setup

  • OS: N/A
  • Database: N/A
  • Python version: 3.12.8
  • Prisma version:
prisma                  : 5.11.0
prisma client python    : 0.13.1
platform                : debian-openssl-3.2.x
expected engine version : efd2449663b3d73d637ea1fd226bafbcf45b3102
installed extras        : []
install path            : /[...]/.venv/lib/python3.12/site-packages/prisma
binary cache dir        : /home/rijenkii/.cache/prisma-python/binaries/5.11.0/efd2449663b3d73d637ea1fd226bafbcf45b3102
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