# Pydantic

62 Hacker News commenters recommended Pydantic and 15 criticized it, November 2025 to November 2026. It was recommended in 10 of 13 months. It meets the Hacker Approved badge rule.

**Verdict:** Python library that validates data against type-annotated models, popular with FastAPI and AI output. Critics call it slow, heavy and prone to breaking changes.

## Why people recommend it

- Catches malformed AI output before use (4 comments): "We wrap tool calls in strict Pydantic schemas to catch and retry malformed JSON before it hits the application logic." ([source](https://news.ycombinator.com/item?id=46206488)) "Use libraries like Instructor or Pydantic to force your models to return valid JSON." ([source](https://news.ycombinator.com/item?id=47184041)) "Pydantic can turn messy AI outputs into clean, predictable data every single time" ([source](https://news.ycombinator.com/item?id=45876435))
- Works with FastAPI and JSON Schema (5 comments): "the return value in resolve/post method will be automatically validated by the pydantic class defined in field annotation" ([source](https://news.ycombinator.com/item?id=45884554)) "the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python" ([source](https://news.ycombinator.com/item?id=49329265)) "I chose FastAPI and Pydantic specifically to give that same "get out of my way" developer experience" ([source](https://news.ycombinator.com/item?id=46612037))
- Runtime type enforcement from annotations (5 comments): "It's dynamically introspectable at runtime, so you can define type, parsing and validation in one go with stuff like pydantic." ([source](https://news.ycombinator.com/item?id=48734056)) "Frameworks like pydantic can help you turn those type hints into something runtime enforcing too." ([source](https://news.ycombinator.com/item?id=50076308)) "Python to be excellent for modelling my problem domain with Pydantic" ([source](https://news.ycombinator.com/item?id=47422212))
- Validates data at API boundaries (3 comments): "The agent uses Pydantic for validating FastAPI schemas and models for the database—those are the contracts that need validation." ([source](https://news.ycombinator.com/item?id=48145069)) "Validate/parsing at boundaries (HTTP/queues) with Pydantic discriminated unions (tagged unions at runtime)" ([source](https://news.ycombinator.com/item?id=46417797)) "Using serde_json and Pydantic, you get deserialization and validation at the same time." ([source](https://news.ycombinator.com/item?id=46117646))

## What people warn about

- Slow and heavyweight dependency (4 comments): "Definitely do not parse each row into eg pydantic models. You lose the entire performance benefit of pandas / polars by doing this." ([source](https://news.ycombinator.com/item?id=46963577)) "Pydantic is great but relatively slow (which matters on edge devices) and can be bloated." ([source](https://news.ycombinator.com/item?id=46409824)) "So far I have been avoiding Pydantic as a huge-ass dependency" ([source](https://news.ycombinator.com/item?id=48453075))
- Feels unpythonic or messy (4 comments): "Pydantic feels so un-pythonic, they're trying to make it like Go or Rust, but its falling flat" ([source](https://news.ycombinator.com/item?id=46165601)) "pydantic, which is completely unnecessary if you had strong typing" ([source](https://news.ycombinator.com/item?id=48111470)) "the mess of typed dicts, dataclasses and pydantic classes" ([source](https://news.ycombinator.com/item?id=48391121))
- Breaking changes between versions (3 comments): "it's easy to accidentally modify a schema and break the ability to deserialize old data" ([source](https://news.ycombinator.com/item?id=47300938)) "Pydantic exports JSON schema with `oneOf` while the google-genai expects `anyOf`" ([source](https://news.ycombinator.com/item?id=46957829)) "Pydantic likes to make changes between libraries" ([source](https://news.ycombinator.com/item?id=48221456))
- Concerns about VC-backed open source (2 comments): "from an open source utility library for typing to take VC money" ([source](https://news.ycombinator.com/item?id=46661813)) "Deno, Pydantic (Both Sequoia) will go the same way as with many other VC backed "open source" dev tools." ([source](https://news.ycombinator.com/item?id=47439336))

## Alternatives hackers recommend

- [Zod](https://hackerapproved.com/p/zod.md): 58 recommend
- [clojure.spec](https://hackerapproved.com/p/clojure-spec.md): 18 recommend
- [Malli](https://hackerapproved.com/p/malli.md): 15 recommend
- [Guardrails AI](https://hackerapproved.com/p/guardrails.md): 5 recommend

## Cite as

Hacker Approved, "Pydantic", https://hackerapproved.com/p/pydantic/ (counts from 1,795,640 Hacker News comments, November 2025 to November 2026).
