apiflask icon indicating copy to clipboard operation
apiflask copied to clipboard

Add `app.etag()` decorator

Open greyli opened this issue 2 years ago • 4 comments

Something like flask-smorest's bp.etag() decorator.

greyli avatar May 03 '22 04:05 greyli

I'm interested in your take on this.

I'm not so happy with the implementation in flask-smorest.

It does the job, but it's a bit awkward and perhaps a bit of a simplification. Also it breaks the separation between decorators as it needs information from inside response that does the dump.

I tried to improve it (https://github.com/marshmallow-code/flask-smorest/tree/rework_etag). I removed a use case that I think is useless. But I couldn't go as far as I wanted and I still have that dependency with response.

Related SO question: https://stackoverflow.com/questions/70838264/computing-an-etag-for-a-rest-api.

lafrech avatar May 03 '22 08:05 lafrech

Thanks for the information!

I haven't started thinking about the implementation of this feature yet.

I will revisit it when I try to implement it.

greyli avatar May 03 '22 09:05 greyli

Hello. May I ask a question about the relationship between APIFlask and flask-smorest?

The first time I heard about APIFlask is in a podcast greyli being interviewed about Flask 2.0. I was not that excited when I took a look at APIFlask first time, cause I found it not any alternative to FastAPI, just seems like a rewrite of flask-smorest. FastAPI uses type hint, while APIFlask and flask-smorest use decorators.

APIFlask seems more like a successor of flask-smorest and it's still during development. Even the author of smorest participate into this project. Is this true?

laggardkernel avatar Jul 12 '22 02:07 laggardkernel

I want to implement this function. Are there any good cases that I can refer to? @lafrech @greyli

FarmerChillax avatar Apr 23 '24 10:04 FarmerChillax