Open
Description
For the API response shape I propose to have something like below. I know might look a bit over engineering for the existing functionality but general API shape is something that is very difficult to change after :)
// for success
{ success: 1, payload: any }
// for error
{ success: 0, error: { message: "Wrong API call", detail: any } }
- payload can be of any shape (depending on the specific endpoint)
- error detail - will probably be either array with errors, or object shape similar to request with errors instead of data attrs
Input validation, a bit in doubts:
- just ignore for now (i don't like , this is a ground concept)
- use some of standard libs. One is very typescript friendly - https://www.npmjs.com/package/class-validator - but looks a bit bloated for me, and requires classes instead of interfaces which imho corrupts the beauty of TS
- Use https://github.com/koorchik/js-validator-livr - a very lightweight, descriptive approach, no dependencies. Used it before, no issues (and I know the author - not sure if it is
+
or-
- but they support and use it quite intesively so it does not go anywhere ;)
Metadata
Metadata
Assignees
Labels
No labels