Validation
56 bites tagged Validation — interview questions with model answers, and 60-second explainers.
Re-evaluating personas when engagement is low
Bring behavioral evidence, separate persona-wrong from execution-wrong, propose joint research to validate or invalidate. Data-driven challenge to assumptions.
Instrumenting a feature to validate a qualitative insight
Restate the pain as a hypothesis, define a primary behavioral metric plus guardrails, instrument events, compare against baseline. Turning qualitative pain into measurable signals.
Pydantic BaseModel vs dataclasses in FastAPI
BaseModel validates and coerces data at runtime, parses and serializes JSON, integrates with OpenAPI schema generation, and supports rich validators; dataclasses only store data with no validation. Why FastAPI standardizes on Pydantic.
How FastAPI uses type hints for validation
Hints drive parsing, validation, and conversion; a path declared int is coerced or returns 422; OpenAPI is auto-generated. Whether you know FastAPI leans on Pydantic and type hints.
Technical principles for building a learning-focused MVP
Validate the riskiest assumption first, use off-the-shelf and manual where possible, instrument for learning, defer scalability and polish. building to learn, not to scale.
Pinpointing validation errors in nested request data
Use schema validation that reports a path, collect all errors not just the first, return a 400 with field paths and messages. structured error reporting for nested input.
Validating request bodies with Express middleware
Run validation middleware before the handler, check email format and password length, return 400 with errors on failure, call next on success. separating validation from business logic via middleware.
Input validation versus output encoding
Validation checks input fits expected rules on entry; encoding makes data safe for a specific output context on exit. You need both; encoding is the real anti-XSS control. Knowing these are complementary, not interchangeable.
Reusable schema validation middleware with Zod or Joi
Define a schema (email, password min 8, optional firstName), write a factory middleware that validates req.body, returns 400 with messages on failure, and assigns the parsed value on success. schema-driven validation as middleware.
Basic presence validation on a POST login route
Ensure the JSON body parser runs, destructure email and password from req.body, return 400 early if either is missing, then proceed. minimal input validation.
Decoupling Form state from its Field components
Form holds values, errors, and status in context, Fields self-register and read/write via a hook, validation composes per field. shared form state without coupling. the Form enumerating every specific field it contains.
How would you architect a multi-step Svelte wizard with Stores?
Tests state isolation and validation orchestration across wizard steps. A solid answer uses a centralized store with step slices, derived validity stores, and pre-navigation guards. Red flag: unrelated per-step stores or validation only on final submit.
How do you structure components and state for a dynamic Vue form?
This tests your design of normalized reactive state for dynamic Vue forms. A great answer uses a flat item array with stable keys, row components or scoped slots, and schema-driven validation. Red flags include mutating by index or using array indices as keys.
How would you build a reusable Svelte validation action?
Tests Svelte action lifecycles versus inline logic. Strong answers describe a node function that attaches input or blur listeners, toggles classes or ARIA directly, returns update and destroy, and cite reusability.
Bind an input to a variable and validate with reactivity
Tests Svelte reactivity: connecting DOM state to validation logic. Good answer: `$state` for the variable, `$effect` to run validation when it changes, cleanup if needed. Red flag: using effects where event handlers suffice or creating infinite loops.
How do you trace data points to journey map stages?
Tests auditable evidence chains for technical buy-in. Answer covers a traceability matrix linking quotes to stages and pain points, plus validation sessions where engineers inspect source data. Red flag: presenting the map as intuition without source docs.
Assumption Mapping: De-Risk Before You Build
Assumption mapping treats product ideas as bundles of unproven bets. Teams sort beliefs into desirability, feasibility, and viability to find the riskiest ones. It prevents shipping features nobody wants. The footgun is treating the map as the finish line.
Simulate Form Validation in Figma
A form prototype is an interactive script, not a picture. You pre-build every state — empty, typing, error, success — and link them so stakeholders feel validation timing before engineers code it. The trap is logic you cannot maintain across design changes.
Runtime Response Validation with Schema Libraries
TypeScript types evaporate at runtime, so a fetch response typed as User[] can be null or malformed. Schema libraries like Zod give static types and runtime guards from one contract. The footgun is using as instead of parse, silently reintroducing crashes.
Design a multi-step wizard form pattern in React
Shared state, step validation, and resilient navigation. A great answer uses one form instance with per-step Zod schemas, a context stepper, and localStorage persistence. Red flag: isolated forms per step that lose data on navigation.
Advantages of dedicated React form libraries over manual state
Your grasp of the hidden costs of fully controlled form state in React. Mention re-render reduction via refs, declarative validation, less boilerplate, and custom input support.
How would you implement real-time client-side validation in React?
Tests state-driven UI thinking over imperative DOM updates. A strong answer uses a status enum like typing or error, derives validation from state instead of redundant booleans, and conditionally renders feedback.
Yup: Schema Builder for Runtime Validation
Yup is a validation pipeline: schemas parse, coerce, and assert untrusted data in one pass. Use it for API payloads or forms while TypeScript infers types automatically.
How do you define a Pydantic model and use it in FastAPI?
Subclass BaseModel with name str and age int, then type-hint the parameter with the model. Whether you use Pydantic BaseModel for request body validation in FastAPI.
Get Validation bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.