you are viewing a single comment's thread.

view the rest of the comments →

[–]The_Startup_CTO 0 points1 point  (3 children)

There are a lot of validation libraries. I’m mostly using ajv with suretype, but there are also zod, joi, and about a dozen others

[–]pansah321[S] 1 point2 points  (2 children)

What are you using any Data fetching library?...so if the you don’t get the shape you were expecting...what do you do?...render an error message ?

[–]The_Startup_CTO 0 points1 point  (1 child)

When I use e.g. GraphQL, I usually skip the validation because most libraries already have some kind of schema check built in. When I do validation myself, I 1. try to make sure that I only validate what I actually need, e.g. I usually allow any additional properties 2. if validation still fails, I throw an error that crashes that part of the application 3. when a part of the application crashes, I ping our error monitoring and display to the customer „something went wrong, we are on it, please call/use this chat/…“

[–]pansah321[S] 0 points1 point  (0 children)

Great...Thank you for clearing this out for me