We do follow this conservative way, Strict schemas Regex validation Input sanitization
We have strictly typed schema for our apis. We have defined schema using protos. We are running grpc service.
Although correct remember exceptions do exist
Then the business people come back shouting why they don't see all the data they entered and why some part of it is missing??? It might be rude in social life to correct people upfront but in API world it is must to enjoy your personal life instead of explaining how liberal your were while trimming their data and changing it to lower/upper case.
Sorry. I don't think we should trim user's long bio. Instead we should give validation error saying it should be less than n.
If someone put their username in camlecase if back and stored in small then while retrieving again how this will be converted into camlecase again
I wasn’t sure about the username example but it does work and make sense if all auth and similar operations know to apply the same transformation to the user input. Thanks Arpit
We use Zod for that in typescript at both our frontend and backend. works like a charm
are you sure about the bio example? if there's a character limit, shouldn't we be failing the operation and sending an error back to the user instead of trimming and saving it which isn't exactly the expected behaviour in most cases. with that being said, nice video 👍
In my view...rulenl is very simple...u should know what user of api will require and what you are needed...simple...baki..use any word to standardize your method as law....for interview.😊
Thanks for reminding me on this
Wouldn’t Input sanitisation while accepting inputs work against “being liberal” while accepting inputs? Like checking for injection or overflow scripts in bio or username string? Although it’s less of an issue to worry about if your dev frameworks takes care of cleaning up of input strings, but still, someone has to be conservative towards what data they’re letting in, isn’t it?
Hi! How can we connect for a project?
Trimming the bio (or) lower casing the username without user acknowledgement seems incorrect.
Amazing
Wh should yhe case be changed before storing it in the db? Is it done to ensure a consistent standard between all the data being stored in the db? Or is there ac actual benefit to this?
Typescript
Thanks for sharing this and actui am following it, but after watching it i felt confident in my learnings #selflearner
Want more depth knowledge about good APIs
@comradepeter87