bauerji / flask-pydantic

flask extension for integration with the awesome pydantic package
MIT License
368 stars 58 forks source link

Is it possible to automatically recognize the parameters of the view as the path query body? #53

Closed ischaojie closed 2 years ago

ischaojie commented 2 years ago

For example:


class BookModel(BaseModel):
    title: str
    price: float

@app.put("/books/<id>")
@validate()
def update_book(id:int, q:str, book_schema: BookModel):
    pass

Will auto recognize id as path param, book_schema as request body params, q as query param, just like FastAPI.

ischaojie commented 2 years ago

I made another lib flask-valid to support this feature, using pydantic, just like FastAPI. You can pass path params, query params, and request body to view func.