Object { msg: "field required", type: "value_error.missing", loc: […] } even when parameters where in body

Viewed 45

value_error.missing even when parameters are present in body enter image description here

enter image description here

1 Answers

After googling almost everything there is and not finding the answer for my problem for few hours, I finally understood what was the problem.

The problem for me was that I was requesting strings directly as arguments to the functions and FastApi was therefore expecting one string -> query string.

Instead, I was supposed to request a model which has two strings

@app.post("/enter/")
def enter(ANNFilePath: str, ECGFilePath: str)
class Item(BaseModel):
    ANNFilePath: str
    ECGFilePath: str

    class Config:
        orm_mode = True

@app.post("/enter/")
def enter(item: Item)
Related