Skip to content

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 · comment

    Use libraries like Instructor or Pydantic to force your models to return valid JSON.

    Feb 2026 · comment

    Pydantic can turn messy AI outputs into clean, predictable data every single time

    Nov 2025 · comment
  • Works 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 · comment

    the support for JSON Schema is much better across the stacks I use, e.g. Zod in JS/TS, Pydantic in Python

    Aug 2026 · comment

    I chose FastAPI and Pydantic specifically to give that same "get out of my way" developer experience

    Jan 2026 · comment
  • Runtime 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 · comment

    Frameworks like pydantic can help you turn those type hints into something runtime enforcing too.

    Oct 2026 · comment

    Python to be excellent for modelling my problem domain with Pydantic

    Mar 2026 · comment
  • Validates 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 · comment

    Validate/parsing at boundaries (HTTP/queues) with Pydantic discriminated unions (tagged unions at runtime)

    Dec 2025 · comment

    Using 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 · comment

    Pydantic is great but relatively slow (which matters on edge devices) and can be bloated.

    Dec 2025 · comment

    So far I have been avoiding Pydantic as a huge-ass dependency

    Jun 2026 · comment
  • Feels 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 · comment

    pydantic, which is completely unnecessary if you had strong typing

    May 2026 · comment

    the mess of typed dicts, dataclasses and pydantic classes

    Jun 2026 · comment
  • Breaking changes between versions · 3

    it's easy to accidentally modify a schema and break the ability to deserialize old data

    Mar 2026 · comment

    Pydantic exports JSON schema with `oneOf` while the google-genai expects `anyOf`

    Feb 2026 · comment

    Pydantic likes to make changes between libraries

    May 2026 · comment
  • Concerns about VC-backed open source · 2

    from an open source utility library for typing to take VC money

    Jan 2026 · comment

    Deno, 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

Every quote

The 40 most detailed of 79 comments. Each links to the original.

  1. 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?”

  2. 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”

  3. 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”

  4. 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)”

  5. Validate/parsing at boundaries (HTTP/queues) with Pydantic discriminated unions (tagged unions at runtime)

    Recommends · Dec 2025 · in “Why Reliability Demands Functional Programming”

  6. 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”

  7. 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”

  8. 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”

  9. 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”

  10. 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”

  11. 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”

  12. 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”

  13. 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)”

  14. Pydantic can turn messy AI outputs into clean, predictable data every single time

    Recommends · Nov 2025

  15. Pydantic exports JSON schema with `oneOf` while the google-genai expects `anyOf`

    Mixed · Feb 2026 · in “GPT-5.3-Codex”

  16. 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”

  17. super helpful error messages to be fed back into the model on retry

    Recommends · Nov 2025 · in “Structured outputs on the Claude Developer Platform”

  18. 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”

  19. from an open source utility library for typing to take VC money

    Mixed · Jan 2026 · in “ClickHouse Acquires Langfuse”

  20. some nice pydantic, type annotated, etc "strong" code bases

    Recommends · Nov 2025 · in “Ruby 4.0.0 Preview2”

  21. 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)”

  22. 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”

  23. 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”

  24. 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”

  25. pydantic, which is completely unnecessary if you had strong typing

    Criticizes · May 2026 · in “If AI Writes Your Code, Why Use Python?”

  26. 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?”

  27. the mess of typed dicts, dataclasses and pydantic classes

    Criticizes · Jun 2026 · in “Elixir v1.20 released: now a gradually typed language”

  28. it just feels messier/clunkier than Zod's parsing options

    Criticizes · Aug 2026 · in “Zod v4.5 adds schema compilation (3-9x faster validation)”

  29. depends on Pydantic, which is itself heavyweight

    Criticizes · Aug 2026 · in “What I love about Django”

  30. Pydantic likes to make changes between libraries

    Criticizes · May 2026 · in “Python 3.15: features that didn't make the headlines”

  31. 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”

  32. 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”

  33. 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”

  34. You could spend more time understanding Pydantic before you make this comment however.

    Recommends · Feb 2026 · in “Parse, Don't Validate (2019)”

  35. 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”

  36. So whats the recommendation? Just use pydantic and code everything up yourself.

    Recommends · Sep 2026 · in “Stripe's Knowledge AI Platform”

  37. Something like Pydantic, Flask or Django + Jinja generally doesn't do that.

    Recommends · Aug 2026 · in “Htmx 4.0”

  38. 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”

  39. 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”

  40. 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