You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to return a lazy queryset from the resource method handler, and some smart (explicit) magic will take care of OpenAPI/Swagger documentation, offsetting and limiting the data, and setting X-Total-Count header to the response.
There are a few solutions I have in mind, but none of them is perfect to me:
Wrap the @api.response() decorator, so we have the input parameters available, the original response, and the control over serialization:
Extend the @api.response decorator to have hooks before the object gets dumped with a schema (so we can limit and offset the queryset), and after the Response is generated (so we can inject the header)
P.S. To document the headers in Swagger.json, we need the latest master of flask-restplus (the latest 0.10.1 release doesn't include the fix for noirbizarre/flask-restplus#119).
The text was updated successfully, but these errors were encountered:
I would expect to return a lazy queryset from the resource method handler, and some smart (explicit) magic will take care of OpenAPI/Swagger documentation, offsetting and limiting the data, and setting
X-Total-Count
header to the response.There are a few solutions I have in mind, but none of them is perfect to me:
Wrap the
@api.response()
decorator, so we have the input parameters available, the original response, and the control over serialization:or
Extend the
@api.response
decorator to have hooks before the object gets dumped with a schema (so we can limit and offset the queryset), and after the Response is generated (so we can inject the header)References:
P.S. To document theheaders
in Swagger.json, we need the latest master of flask-restplus (the latest 0.10.1 release doesn't include the fix for noirbizarre/flask-restplus#119).The text was updated successfully, but these errors were encountered: