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

JSONB, post raise exception #172

Open
mmmcorpsvit opened this issue May 7, 2024 · 0 comments
Open

JSONB, post raise exception #172

mmmcorpsvit opened this issue May 7, 2024 · 0 comments

Comments

@mmmcorpsvit
Copy link

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?

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