Not

Hacker News!

Beta
Home
Jobs
Q&A
Startups
Trends
Users
Live
AI companion for Hacker News

Not

Hacker News!

Beta
Home
Jobs
Q&A
Startups
Trends
Users
Live
AI companion for Hacker News
  1. Home
  2. /Story
  3. /Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library
  1. Home
  2. /Story
  3. /Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library
Nov 23, 2025 at 8:43 AM EST

Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

podperson
35 points
20 comments

Mood

informative

Sentiment

positive

Category

tech_discussion

Key topics

Json Schema

Library

Npm Package

Llm-Native

Discussion Activity

Light discussion

First comment

N/A

Peak period

5

Hour 1

Avg / period

3

Comment distribution27 data points
Loading chart...

Based on 27 loaded comments

Key moments

  1. 01Story posted

    Nov 23, 2025 at 8:43 AM EST

    18h ago

    Step 01
  2. 02First comment

    Nov 23, 2025 at 8:43 AM EST

    0s after posting

    Step 02
  3. 03Peak activity

    5 comments in Hour 1

    Hottest window of the conversation

    Step 03
  4. 04Latest activity

    Nov 23, 2025 at 9:20 PM EST

    5h ago

    Step 04

Generating AI Summary...

Analyzing up to 500 comments to identify key contributors and discussion patterns

Discussion (20 comments)
Showing 27 comments
podperson
18h ago
2 replies
I wrote this library this weekend after realizing that Zod was really not designed for the use-cases I want JSON schemas for: 1) defining response formats for LLMs and 2) as a single source of truth for data structures.
7thpower
17h ago
3 replies
What led you to that conclusion?
nerdponx
17h ago
1 reply
And what makes this different? What makes it LLM-native?
podperson
16h ago
1 reply
It generates schemas that are strict by default while Zod requires you to set everything manually.

This is actually discussed in the linked article (READ ME file).

halayli
15h ago
1 reply
That's not true based on zod docs. https://zod.dev/api?id=objects

most of the claims you're making against zod is inaccurate. the readme feels like false claims by ai.

podperson
14h ago
It seems to be true to me. And aside from the API stuff (because I am far from an expert user of Zod) all of this has been carefully verified.
dsabanin
17h ago
2 replies
Zod's validation errors are awful, the json schema it generates for LLM is ugly and and often confusing, the types structures Zod creates are often unintelligible in the and there's even no good way to pretty print a schema when you're debugging. Things are even worse if you're stuck with zod/v3
sesm
16h ago
What's wrong with Zod validation errors?
light_hue_1
15h ago
None of this makes a lot of sense. Validation errors are largely irrelevant for LLMs and they can understand them just fine. The type structure looks good for LLMs. You can definitely pretty print a schema at runtime.

This all seems pretty uninformed.

podperson
16h ago
1. Zoe’s documentation, such as it is 2. Code examples
taveras
13h ago
Happy to see more tools in the data schema space.

Will you support Standard Schema (https://standardschema.dev)? How does this compare to typebox (https://github.com/sinclairzx81/typebox)?

_heimdall
17h ago
1 reply
Had you considered using something like XML as the transport format rather than JSON? If the UX is similar to zod it wouldn't matter what the underlying data format is, and XML is meant to support schemas unlike JSON.
podperson
16h ago
2 replies
JSON Schema is a schema built on JSON and it’s already being used. Using XML would mean converting the XML into JSON schema to define the response from the LLM.

That said, JSON is “language neutral” but also super convenient for JavaScript developers and typically more convenient for most people than XML.

yeasku
15h ago
2 replies
LLMs are not people.

We want a format for LLMs or for people?

podperson
15h ago
1 reply
JSON schema is very human readable.
_heimdall
5h ago
Why does that matter though? MCP is meant for LLMs not humans, and for something like this lib it seems the human side if the API is based on JavaScript not JSON.
drowsspa
14h ago
1 reply
As a person myself, I very much prefer JSON
_heimdall
5h ago
MCP isn't meant for humans though, I'm not side why it matters what a human would prefer
_heimdall
13h ago
1 reply
Maybe I missed a detail here, sorry if that's the case!

Why would we need to concert XML, which already supports schemas and is well understood by LLMs, back to JSON schema?

verdverm
12h ago
1 reply
Because most of the world uses JSON and has rich tooling for JSONSchemas, notable many LLM providers allow JSONSchemas to be part of the request when trying to get structured output
_heimdall
6h ago
LLM providers allow sending any string of text though, right? In my experience the LLN understands XML really well, though obviously that doesn't negate them from understanding JSONSchema.
yunohn
15h ago
1 reply
> It checks a fixed sample of items (roughly 1%) regardless of size

> This provides O(1) performance

Wouldn’t 1% of N still imply O(N) performance?

podperson
14h ago
1 reply
N is increasing. O(1) means constant (actually capped). We never check more than 100 items.
SkiFire13
13h ago
Then it's not 1%, because if you have 100k items and you check at most 100 you have checked at most 0.1% of items.
kevmo314
13h ago
1 reply
> For large arrays (>97 items) and large dictionaries

How did we end up in a world where 97 items is considered large?

vages
11h ago
Mind your off-by-1s: 97 items is not large, 98 is.
bbminner
15h ago
While llms accept json schemas for constrained decoding, they might not respect all of the constraints.
View full discussion on Hacker News
ID: 46023531Type: storyLast synced: 11/23/2025, 6:43:50 PM

Want the full context?

Jump to the original sources

Read the primary article or dive into the live Hacker News thread when you're ready.

Read ArticleView on HN

Not

Hacker News!

AI-observed conversations & context

Daily AI-observed summaries, trends, and audience signals pulled from Hacker News so you can see the conversation before it hits your feed.

LiveBeta

Explore

  • Home
  • Jobs radar
  • Tech pulse
  • Startups
  • Trends

Resources

  • Visit Hacker News
  • HN API
  • Modal cronjobs
  • Meta Llama

Briefings

Inbox recaps on the loudest debates & under-the-radar launches.

Connect

© 2025 Not Hacker News! — independent Hacker News companion.

Not affiliated with Hacker News or Y Combinator. We simply enrich the public API with analytics.