Custom/uniform response schema #1013
Unanswered
johnbridstrup
asked this question in
Q&A
Replies: 2 comments 4 replies
-
|
I considered a decorator along the lines of def wrap_response(schema):
class FullSchema(Schema):
data: schema
code: int
meta: str
return FullSchemaBut then I would have to do extra work building the response in the endpoints. I'd still like to be able to just return e.g. edit: it also breaks with list responses of a schema |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
could you show some use cases ? would you fill "code=200" inside view function or it should just copy http response status ? same for meta=info |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to have a custom response format for all responses in my api, something like
{ "data": {...}, # What would normally be returned "code": 200, "meta": "info" }Is there any way to do this built in? If not, would I want to create a custom
SchemaorModelSchemaclass to do this? Not sure where to begin so figured I'd ask here first.Beta Was this translation helpful? Give feedback.
All reactions