Yup: Schema validation and parsing for runtime values
JavaScript schema validation with chainable API and type inference.
Learn more about Yup
Yup is a JavaScript schema validation library that combines parsing (value transformation) and assertion (validation testing) into a chainable API. It works by defining schemas composed of type definitions and validation rules, then applying those schemas to input values through validate(), validateSync(), or cast() methods. The library generates detailed error information when validation fails and supports complex interdependent validations across nested objects and arrays. Common use cases include form validation in web applications, API request/response validation, and data transformation pipelines.
TypeScript type inference
Schemas can automatically generate static TypeScript types via the InferType utility, allowing type safety without manual type definitions. Conversely, existing TypeScript types can be validated against schemas to ensure correctness.
Async validation support
Built-in support for asynchronous validation rules enables server-side validation checks and cross-field async operations within the same schema definition, rather than requiring separate client and server validation logic.
Parsing and validation combined
Schemas handle both type coercion and validation in a single pass. The cast() method performs type conversion without assertions, while validate() applies both transformations and tests, allowing flexible usage patterns.
import * as yup from 'yup';
const userSchema = yup.object({
email: yup.string().email().required(),
age: yup.number().positive().integer().min(18)
});
const userData = { email: 'user@example.com', age: 25 };
const validUser = await userSchema.validate(userData);Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
Cursor
Local code editor with integrated LLM assistance.
tldr-pages
Community-maintained concise help pages for CLI tools with practical examples.
bat
Enhanced cat replacement with syntax highlighting and Git integration for file viewing.
wifi-password
Bash utility for extracting Wi-Fi passwords from macOS keychain storage.
CXX
Safe FFI library for calling C++ from Rust and vice versa with zero-overhead bindings via code generation.
Related Reading
Guides and comparisons from the Greptile content library
Flaky Tests: What Is a Flaky Test and How Do You Manage Them?
What flaky tests are, what causes them, how to detect them, and 12 ways to fix them. Plus why end-to-end tests are more prone to flakiness, and how seeing what actually happened during a run helps you tell a test problem from a code problem.
Best Security-Focused AI Code Review Tools [2026 Guide]
The six best security-focused AI code review tools, compared on SAST, SCA, DAST, and full-repo context, so you can pick the one that fits your codebase and your cycle times.
What Is Code Review? (And How to Keep It From Becoming the Bottleneck)
What code review is, how traditional, automated, and AI code review differ, and why review is now the bottleneck as AI writes more code. Plus how to pick a code review tool that catches real bugs.
9 Best Pull Request Automation Tools [2026]
Nine pull request automation tools compared on features, use cases, pricing, and user feedback, so you can work out which one closes the gap between how fast your team writes code and how fast it can review it.