amisadmin / fastapi-amis-admin

FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by django-admin, and has as many powerful functions as django-admin.
http://docs.amis.work
Apache License 2.0
1.09k stars 161 forks source link

JSONB, post raise exception #172

Open mmmcorpsvit opened 6 months ago

mmmcorpsvit commented 6 months ago
class Lot(PkModelMixin, CreateTimeModelMixin, UpdateTimeModelMixin, table=True):
    data: dict = AdminField(title='Data', sa_column=Column("data", JSONB, nullable=True), default=None, )

try post correct JSON

{"a": "1"}

raise exception

{
    "status": 422,
    "msg": "Request parameter validation exception",
    "data": null,
    "code": null,
    "body": {
        "updated": "2024-05-17T18:01:21",
        "created": "2024-05-02T18:01:25",
        "vin": "2C3CDXHG2NH169812",
        "sale_datetime": "2024-05-15T18:00:35",
        "item": 45345,
        "number": 45345,
        "year": 2020,
        "active": false,
        "odometer": 0,
        "data": "{\"a\": \"1\"}",
        "status_id": 3,
        "color_id": 956,
        "lot_model_id": 1,
        "location_id": 9938,
        "has_keys": 2
    },
    "errors": [
        {
            "type": "dict_type",
            "loc": [
                "body",
                "data"
            ],
            "msg": "Input should be a valid dictionary",
            "input": "{\"a\": \"1\"}"
        }
    ]
}

how fix?