Skip to content

Validation error for User #72

Closed
Closed
@escapenate

Description

@escapenate

Hi

I used the cookiecutter to create this project locally on macOS 10.14.6 and ran it without making any changes.

I ran into the following issue with the API (and consequently the frontend):

backend_1        | pydantic.error_wrappers.ValidationError: 1 validation error for User
backend_1        | response -> 0
backend_1        |   value is not a valid dict (type=type_error.dict)

This example was with /api/v1/users/me but it occurred with all APIs returning the User model.

I was able to successfully return the user in raised exceptions all the way through the backend processing, so it seems that the validation error is being raised from db_session_middleware .

Adding the orm_mode property to the UserBase model seemed to fix the issue. ie.

class UserBase(BaseModel):
    email: Optional[str] = None
    is_active: Optional[bool] = True
    is_superuser: Optional[bool] = False
    full_name: Optional[str] = None

    class Config:
        orm_mode = True

I'm not sure whether this is a bug, or something to do with my configuration or OS - but this was a completely vanilla build, so perhaps I'm not the only person to encounter this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions