#validation

10 snippets tagged with #validation

typescriptbeginner

Environment Variable Validator

Validates required environment variables at startup and returns a typed config object or throws with missing keys.

#config#validation
typescriptbeginner

Express Zod Request Validation

Validate Express request body, params, and query with Zod schemas via reusable middleware.

#express#zod
typescriptintermediate

useFormValidation Hook

Lightweight form validation hook with field-level errors, touched tracking, and submit handling.

#hooks#forms
typescriptintermediate

Type-Safe API Route Handler

Next.js App Router route handler with input validation, typed responses, and proper error handling.

#api#route-handler
typescriptintermediate

Server Action with Form Validation

Next.js Server Action handling form submissions with validation, error messages, and redirect on success.

#server-actions#forms
typescriptbeginner

Environment Variable Validation

Validate required environment variables at build time with type-safe access and descriptive errors.

#environment#validation
pythonbeginner

Dataclass with Validation

Python dataclass with __post_init__ field validation, type coercion, and descriptive error messages.

#dataclass#validation
pythonbeginner

Pydantic v2 Model Patterns

Define and validate data models with Pydantic v2 using field validators, computed fields, and serialization.

#pydantic#validation
pythonbeginner

Dataclasses with Post-Init Processing

Use Python dataclasses with __post_init__ for computed fields, validation, and default factories.

#dataclasses#python
pythonintermediate

Data Validation with Pydantic

Validate and parse data records using Pydantic models with custom validators and error reporting.

#validation#pydantic