Changes proposed in this pull request:
Personally I think it is not best practice to return pretty printed json. This only unnecessarily enlarges the payload to be returned and this increase can be significant. Pretty printing should be
handled by the client instead.
Fix: Personally I think it is not best practice to return pretty printed
json. This only unnecessarily enlarges the payload to be
returned and this increase can be significant. Pretty printing should be
handled by the client instead
As a side note: I can of course return a flask Response object with my own non-pretty printed json - but then response validation in connexion does not work, and this is one of the feature I like (amongst others) very much.
Coverage remained the same at 100.0% when pulling 665b25f on sebastianmika:master into 5892feb on zalando:master.
@sebastianmika I personally agree, the response JSON should be machine-readable, humans can use their favorite client (e.g. HTTPie) to get pretty output.
@sebastianmika basically this PR reverts #193, see the discussion there (BTW I still agree with you about not having pretty printed by default).
Regarding what is best practice or not, I found little relevant stuff. However, at one place it was correctly stated that enabling compression is much more important than whether one pretty prints the json or not.
Using flask-compress and adding to my create_app
compress = Compress()
that is quickly done and indeed had a much greater impact than not pretty printing.
The same source also argued as gdb from #193 - API results should be nice to look at for developers without any hassle.
So, I would rather close my own PR and go with compression, unless you make a strong point against that.
As an alternative, as also discussed in #193, pretty or not could be an option to connexion.App and/or add_api, but I don't know when I would have the time to add that.
@sebastianmika OK, if you are fine with closing your PR 😄