REST API Validation in a Typescript front-end
summary
Demo front end calls a Pokemon REST API and validates responses with Yup, Zod and io-ts, proving runtime checks plus generated TypeScript types catch real breakages. Implementation details: Yup optional-by-default, Zod TypeScript-first and strips unknown fields, io-ts returns an Either for functional error handling. A small React app exercises all three, shows validation errors when the API changes, and demonstrates differences in ergonomics and type quality; note added runtime cost and the need to keep schemas in sync.
AI-written summary · about
chapters (12)
- 0:00REST API validation intro
- 1:47API response data and contracts
- 2:50Compile-time type limits
- 3:55Runtime validation with schemas
- 6:04Validation libraries: Yup, Zod, io-ts
- 7:31Yup schemas
- 10:21Zod schemas
- 12:29io-ts functional validation
- 13:10Advanced validation tricks
- 15:26Choosing a validation library
- 16:49Live React validation demo
- 19:00Q&A
related talks
45mBuild Fully Type Safe Projects with TypeScript and Zod
21mBeyond Type Checking Building Bulletproof TypseScript Applications
31mEscaping the Phantom Zone of Insecure Data: Build Safer Applications with zod
35mFull-stack Type Safety with React, GraphQL, and TypeScript
29mCrafting Reliable and Testable Code with TypeScript
21mKeep alive your typescript definitions using Zod
23mType-safe forms for React using Zod
15mValidate HTTP request with HttpClient & Zod - Lightning talk
