-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the feature you'd like to request
Why can not tRPC format the http response/methods/pathnames as one would like it to? What if users want to integrate with external service/external API? It is currently really hard to override/maybe not possible to change tRPC response structure. This is something that holding me back from implementing different errors responses and response payload.
I believe the opinionated approach is not best way to go, this my biggest limiting factor with the library.
Describe the solution you'd like to see
Allows user to defined their, pathnames, and HTTP methods. The most important for me is to allow the user to defined their payload response.
Describe alternate solutions
Not relavent
Additional information
For example for 200 response allow the user to change the "template" of the response, from:
[{ "result": { "data": { "data": { "key": "value" } } } }]To allow the user to specify things like this for example (or whatever they decide to do):
{ "data": { "key": "value" } }And this worst with errors:
[
{
"error": {
"message": "Invalid email or password",
"code": -32603,
"data": {
"code": "INTERNAL_SERVER_ERROR",
"httpStatus": 500,
"path": "auth.login"
}
}
}
]I do not want to have error messages, because my app is internationalized and I do not have use of them. I only require errorCode, it would be nice if I could be able to specify my own format.
👨👧👦 Contributing
- 🙋♂️ Yes, I'd be down to file a PR implementing this feature!