Schemars

Generate JSON Schema documents directly from Rust types

Library
Cargo
v1.2.2
1,400stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
67/100Good
Development Activity48
Maintenance52
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture82
Code Quality85
Innovation75
Learning Curve80

Schemars derives JSON Schema documents from Rust structs and enums with a single #[derive(JsonSchema)] macro, reusing the same field attributes (rename, skip, default) that serde already understands so your schema and your serialization stay in sync automatically. It ships JsonSchema implementations for most of the standard library plus popular crates (chrono, uuid, bytes, indexmap, rust_decimal) behind feature flags.

Because the generated schema is built from actual Rust type definitions rather than hand-written separately, Schemars is commonly used to produce OpenAPI-compatible schemas, validate config files, or describe tool/function-call interfaces for LLM integrations without maintaining a second schema definition by hand.

What You Get

  • A #[derive(JsonSchema)] macro plus schema_for!/schema_for_value! macros for one-line schema generation
  • Automatic reuse of serde attributes (rename, skip_serializing_if, default) so schema and serialization never drift
  • Built-in JsonSchema implementations for most std types and, via feature flags, chrono, uuid, bytes, indexmap, rust_decimal, and more
  • A Generator/SchemaSettings API for customizing schema draft version, $ref strategy, and inline-vs-referenced definitions
  • no_std-compatible core so it can run in embedded or constrained environments

Common Use Cases

  • Generating OpenAPI-compatible request/response schemas for a Rust web API (Axum, Actix, Rocket) alongside existing serde models
  • Producing JSON Schema tool/function definitions for LLM function-calling from native Rust structs
  • Validating configuration files against a schema derived straight from the config struct definition
  • Publishing a public JSON Schema for a data format defined by a Rust type, without maintaining it by hand

Under The Hood

Architecture: schemars/src/lib.rs defines the JsonSchema trait and re-exports the derive macro from the sibling schemars_derive proc-macro crate; generate.rs and schema.rs implement the actual schema-building logic and settings (draft version, $ref inlining), while json_schema_impls/ provides JsonSchema implementations for every supported type, gated behind per-crate feature flags (chrono04, uuid1, indexmap2, etc.) so consumers only compile in what they use.

Tech Stack: Pure Rust, no_std-compatible core (categories = ["encoding", "no-std"] in Cargo.toml) built on serde/serde_json plus small utility crates (dyn-clone, ref-cast); optional integrations use versioned feature-flag naming (e.g. chrono04, bigdecimal04) to support multiple major versions of dependent crates simultaneously.

Code Quality: The schemars crate ships 61+ integration/unit test files covering type-by-type schema output (including snapshot-style expected-JSON comparisons and an update-tests.sh regeneration script), reflecting the project’s need for byte-stable schema output across releases; clippy.toml enforces lint discipline project-wide.

API Design: The primary entry point is a single derive macro plus one macro call (schema_for!(MyType)), so most users never touch the Generator/SchemaSettings customization API at all — advanced schema-shape control (draft version, $ref policy) is opt-in rather than required, keeping the common case a two-line change to an existing serde-derived struct.

Used by 11 apps in this directory

Dart
74%
AGPL 3.0

AppFlowy

Productivity · Project Management · Collaboration

75,729

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
66
Dependency
Built with
Dart74%
Rust24%
Updated 1 weeks ago
Rust
86%
Other

Arroyo

Data Engineering · Analytics

5,005

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust86%
Updated 1 weeks ago
TypeScript
55%
Other

Cap

Team Chat · Video Conferencing

20,986

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
TypeScript55%
Rust40%
Updated yesterday
Rust
87%
MIT

fabro

Developer Tools · Devops

1,516

Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.

View details
81
Repo Health
83
Technical
70
Dependency
Built with
Rust87%
TypeScript11%
Updated yesterday
Rust
91%
Apache 2.0

herdr

AI Agents · Developer Tools

30,468

A terminal-native agent multiplexer that runs Claude, Codex, Gemini, and other coding agents side by side in real, persistent panes you can detach from and reattach to from anywhere.

View details
83
Repo Health
84
Technical
76
Dependency
Built with
Rust91%
Updated today
Rust
72%
Other

iii

Developer Tools · Devops

18,604

Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.

View details
86
Repo Health
85
Technical
69
Dependency
Built with
Rust72%
TypeScript17%
Updated yesterday
TypeScript
69%
Apache 2.0

Laminar

AI Development · Monitoring

3,180

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
70
Dependency
Built with
TypeScript69%
Rust29%
Updated yesterday
Rust
72%
Apache 2.0

mesh-llm

AI Development · AI Agents

3,258

Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.

View details
83
Repo Health
91
Technical
70
Dependency
Built with
Rust72%
TypeScript16%
Updated today
TypeScript
70%
AGPL 3.0

Silex

No Code Platforms · Design Tools

2,928

Free, open-source visual website builder that exports clean HTML/CSS — no lock-in, no subscription, host anywhere

View details
88
Repo Health
68
Technical
69
Dependency
Built with
TypeScript70%
JavaScript13%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search