fastapi-utils icon indicating copy to clipboard operation
fastapi-utils copied to clipboard

How use exclude In fastapi-utils?

Open ciaoyizhen opened this issue 6 months ago • 1 comments

In fastapi Document:

@app.get("/items/{item_id}/public", response_model=Item, response_model_exclude={"tax"})
async def read_item_public_data(item_id: str):
    return items[item_id]

We can use response_model_exclude

In fastapi-utils:

class MyApi(Resource):
    def __init__(self, mongo_client):
        self.mongo = mongo_client

    @set_responses(ResponseModel)
    def get(self):
        return "Done"

how to set exclude

ciaoyizhen avatar Aug 01 '24 09:08 ciaoyizhen