Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

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

@rijenkii

Description

@rijenkii

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

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