#validation
10 snippets tagged with #validation
Environment Variable Validator
Validates required environment variables at startup and returns a typed config object or throws with missing keys.
Express Zod Request Validation
Validate Express request body, params, and query with Zod schemas via reusable middleware.
useFormValidation Hook
Lightweight form validation hook with field-level errors, touched tracking, and submit handling.
Type-Safe API Route Handler
Next.js App Router route handler with input validation, typed responses, and proper error handling.
Server Action with Form Validation
Next.js Server Action handling form submissions with validation, error messages, and redirect on success.
Environment Variable Validation
Validate required environment variables at build time with type-safe access and descriptive errors.
Dataclass with Validation
Python dataclass with __post_init__ field validation, type coercion, and descriptive error messages.
Pydantic v2 Model Patterns
Define and validate data models with Pydantic v2 using field validators, computed fields, and serialization.
Dataclasses with Post-Init Processing
Use Python dataclasses with __post_init__ for computed fields, validation, and default factories.
Data Validation with Pydantic
Validate and parse data records using Pydantic models with custom validators and error reporting.