Developer tools · data validation library
Pydantic
Hacker Approved
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.
Summarized from 79 comments.
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.
- recommend
- 62
- criticize
- 15
- months recommended
- 10 of 13
Why people love it
Catches malformed AI output before use · 4
We wrap tool calls in strict Pydantic schemas to catch and retry malformed JSON before it hits the application logic.
Dec 2025 · commentUse libraries like Instructor or Pydantic to force your models to return valid JSON.
Feb 2026 · commentPydantic can turn messy AI outputs into clean, predictable data every single time
Nov 2025 · commentWorks with FastAPI and JSON Schema · 5
the return value in resolve/post method will be automatically validated by the pydantic class defined in field annotation
Nov 2025 · commentthe support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python
Aug 2026 · commentI chose FastAPI and Pydantic specifically to give that same "get out of my way" developer experience
Jan 2026 · commentRuntime type enforcement from annotations · 5
It's dynamically introspectable at runtime, so you can define type, parsing and validation in one go with stuff like pydantic.
Jun 2026 · commentFrameworks like pydantic can help you turn those type hints into something runtime enforcing too.
Oct 2026 · commentPython to be excellent for modelling my problem domain with Pydantic
Mar 2026 · commentValidates data at API boundaries · 3
The agent uses Pydantic for validating FastAPI schemas and models for the database—those are the contracts that need validation.
May 2026 · commentValidate/parsing at boundaries (HTTP/queues) with Pydantic discriminated unions (tagged unions at runtime)
Dec 2025 · commentUsing serde_json and Pydantic, you get deserialization and validation at the same time.
Dec 2025 · comment
What people warn about
Slow and heavyweight dependency · 4
Definitely do not parse each row into eg pydantic models. You lose the entire performance benefit of pandas / polars by doing this.
Feb 2026 · commentPydantic is great but relatively slow (which matters on edge devices) and can be bloated.
Dec 2025 · commentSo far I have been avoiding Pydantic as a huge-ass dependency
Jun 2026 · commentFeels unpythonic or messy · 4
Pydantic feels so un-pythonic, they're trying to make it like Go or Rust, but its falling flat
Dec 2025 · commentpydantic, which is completely unnecessary if you had strong typing
May 2026 · commentthe mess of typed dicts, dataclasses and pydantic classes
Jun 2026 · commentBreaking changes between versions · 3
it's easy to accidentally modify a schema and break the ability to deserialize old data
Mar 2026 · commentPydantic exports JSON schema with `oneOf` while the google-genai expects `anyOf`
Feb 2026 · commentPydantic likes to make changes between libraries
May 2026 · commentConcerns about VC-backed open source · 2
from an open source utility library for typing to take VC money
Jan 2026 · commentDeno, Pydantic (Both Sequoia) will go the same way as with many other VC backed "open source" dev tools.
Mar 2026 · comment
What hackers pick instead
- ZodPopular TypeScript schema library that validates untrusted data at boundaries and infers static types. Critics cite added dependency weight, inferred-type quirks, and the reported 4.6.6 malware compromise.58recommend
- clojure.specBuilt into Clojure, spec lets people express structural guarantees more expressively than an ordinary type system. Critics say it mostly retrofits static typing onto a dynamic language.18recommend
- MalliA Clojure library for runtime data validation and schema-based example generation; commenters prefer it to ordinary type systems for rigidity.15recommend
- Guardrails AIDevelopers recommend it for forcing AI agents to pass tests and build checks, and for being simpler with less code. It is free software.5recommend
Every quote
The 40 most detailed of 79 comments. Each links to the original.
The agent uses Pydantic for validating FastAPI schemas and models for the database—those are the contracts that need validation.
Recommends · May 2026 · in “If AI Writes Your Code, Why Use Python?”
It's dynamically introspectable at runtime, so you can define type, parsing and validation in one go with stuff like pydantic.
Recommends · Jun 2026 · in “Parse, Don't Validate – In a Language That Doesn't Want You To”
the return value in resolve/post method will be automatically validated by the pydantic class defined in field annotation
Recommends · Nov 2025 · in “Visualize FastAPI endpoints with FastAPI-Voyager”
We wrap tool calls in strict Pydantic schemas to catch and retry malformed JSON before it hits the application logic.
Recommends · Dec 2025 · in “Show HN: Open-source reference architecture for AI Agents (LangGraph, Pydantic)”
Validate/parsing at boundaries (HTTP/queues) with Pydantic discriminated unions (tagged unions at runtime)
Recommends · Dec 2025 · in “Why Reliability Demands Functional Programming”
the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python
Recommends · Aug 2026 · in “Protobuf has LSP support. You're welcome”
I chose FastAPI and Pydantic specifically to give that same "get out of my way" developer experience
Recommends · Jan 2026 · in “Show HN: SnackBase – Open-source, GxP-compliant back end for Python teams”
the hard work that the original designers of libraries like FastAPI, Zod, Pydantic, have invested in
Recommends · Mar 2026 · in “FastAPI-compatible Python framework with Zig HTTP core; 7x faster”
they're very easy to use. Define your schema with Pydantic and pass the class to your client calls
Recommends · Nov 2025 · in “Structured outputs on the Claude Developer Platform”
Frameworks like pydantic can help you turn those type hints into something runtime enforcing too.
Recommends · Oct 2026 · in “11 year old unsoundness bugs found in Rust borrow checker”
Pydantic is great but relatively slow (which matters on edge devices) and can be bloated.
Mixed · Dec 2025 · in “Show HN: Jsonic – Python JSON serialization that works”
Using serde_json and Pydantic, you get deserialization and validation at the same time.
Recommends · Dec 2025 · in “Why I stopped using JSON for my APIs”
Use libraries like Instructor or Pydantic to force your models to return valid JSON.
Recommends · Feb 2026 · in “The Era of Agentic Workflows (and why 80% reliability is a failure)”
Pydantic can turn messy AI outputs into clean, predictable data every single time
Recommends · Nov 2025
Pydantic exports JSON schema with `oneOf` while the google-genai expects `anyOf`
Mixed · Feb 2026 · in “GPT-5.3-Codex”
Python to be excellent for modelling my problem domain with Pydantic
Recommends · Mar 2026 · in “Python 3.15's JIT is now back on track”
super helpful error messages to be fed back into the model on retry
Recommends · Nov 2025 · in “Structured outputs on the Claude Developer Platform”
I found Pydantic annotations to be specifically useful for this.
Recommends · Nov 2025 · in “Show HN: Turn any webpage into structured data via LLM codegen”
from an open source utility library for typing to take VC money
Mixed · Jan 2026 · in “ClickHouse Acquires Langfuse”
some nice pydantic, type annotated, etc "strong" code bases
Recommends · Nov 2025 · in “Ruby 4.0.0 Preview2”
Definitely do not parse each row into eg pydantic models. You lose the entire performance benefit of pandas / polars by doing this.
Criticizes · Feb 2026 · in “Parse, Don't Validate (2019)”
Deno, Pydantic (Both Sequoia) will go the same way as with many other VC backed "open source" dev tools.
Criticizes · Mar 2026 · in “OpenAI to Acquire Astral”
Pydantic feels so un-pythonic, they're trying to make it like Go or Rust, but its falling flat
Criticizes · Dec 2025 · in “Thoughts on Go vs. Rust vs. Zig”
it's easy to accidentally modify a schema and break the ability to deserialize old data
Criticizes · Mar 2026 · in “Show HN: Skir – A schema language I built after 15 years of Protobuf friction”
pydantic, which is completely unnecessary if you had strong typing
Criticizes · May 2026 · in “If AI Writes Your Code, Why Use Python?”
So far I have been avoiding Pydantic as a huge-ass dependency
Criticizes · Jun 2026 · in “Are you expected to run five Python type-checkers now?”
the mess of typed dicts, dataclasses and pydantic classes
Criticizes · Jun 2026 · in “Elixir v1.20 released: now a gradually typed language”
it just feels messier/clunkier than Zod's parsing options
Criticizes · Aug 2026 · in “Zod v4.5 adds schema compilation (3-9x faster validation)”
depends on Pydantic, which is itself heavyweight
Criticizes · Aug 2026 · in “What I love about Django”
Pydantic likes to make changes between libraries
Criticizes · May 2026 · in “Python 3.15: features that didn't make the headlines”
I've found a mix of declarative container type libraries (pydantic on backend, TypeBox on frontend) with some code generation is a good solution.
Recommends · Dec 2025 · in “Django 6”
Python already has libraries like Pydantic that offload performance to functions written in Rust under the hood
Recommends · Aug 2026 · in “Mojo 1.0 Is Here”
The Pydantic stuff is nice, but in a minimalist way that I don't see being amenable to SaaS/vc/etc.
Recommends · Jan 2026 · in “ClickHouse Acquires Langfuse”
You could spend more time understanding Pydantic before you make this comment however.
Recommends · Feb 2026 · in “Parse, Don't Validate (2019)”
my two favorite python shops right now, they're always dropping fun new projcts
Recommends · Feb 2026 · in “Monty - A minimal, secure Python interpreter written in Rust”
So whats the recommendation? Just use pydantic and code everything up yourself.
Recommends · Sep 2026 · in “Stripe's Knowledge AI Platform”
Something like Pydantic, Flask or Django + Jinja generally doesn't do that.
Recommends · Aug 2026 · in “Htmx 4.0”
I do love the Pydantic functionality that comes out of the box w pyscopg3.
Recommends · Mar 2026 · in “Show HN: Oxyde – Pydantic-native async ORM with a Rust core”
it's helpful for generating good error messages on the record create path
Recommends · Oct 2026 · in “Agents don't need memory, they need documentation”
they are useful in and of themselves as internal business/domain objects
Recommends · Mar 2026 · in “Show HN: Oxyde – Pydantic-native async ORM with a Rust core”
Counts from 1,795,640 Hacker News comments, Nov 2025 to Nov 2026. How we count · Report a mistake