Structure of ActionPayload?
josefsabl opened this issue · 2 comments
This is a question, not an issue.
In the ActionPayload class there is this suggested unified structure of responses:
{
'statusCode': 200,
'data': ...
}
Is there any reasoning behind that? Isn't the status redundant here as it is already part of the http message? It also adds the need for arbitrary 'data' element.
Why not just send data? Like in the root of the response.
I understand the skeleton is opinionated structure and I am free to change it but I am interested in the reason behind this decision.
Thank you!
This is a typical response wrapper architecture to normalize the structure of the response. For example Instagram uses this format:
{
"data": {
"viewer": null,
"user": "l0gicgate"
},
"status": "ok"
}
ASP.NET Response Wrappers
{
"Version": "1.0.0.0",
"StatusCode": 200,
"Message": "Request successful.",
"Result": [
"value1",
"value2"
]
}
As you said, it is opinionated. You can change it to fit your needs as necessary.
Thank you!