19

I do a Post with some parameters, but one of them returns "field required" and "value_error.missing", but the field is there and it has a value. See the output of Postman. field "body" is not missing

In schemas.py the fields are defined as follows:

class Message(BaseModel):
    title: str
    id: int
    datim: Optional[datetime]
    to_id: Optional[int]
    from_id: Optional[int]
    body: Optional[str]

    class Config:
        orm_mode = True

So why does it complain about 'body'?

zappfinger
  • 497
  • 2
  • 5
  • 15

2 Answers2

7

It turned out I had an extra argument in my function for @app.post() that was not used.

Removing that solved the problem.

user
  • 5,370
  • 8
  • 47
  • 75
zappfinger
  • 497
  • 2
  • 5
  • 15
1

This is for anyone who still has issues with this, I had a one to one relationship but had not specified uselist=False while defining the relationship.

user
  • 5,370
  • 8
  • 47
  • 75