Huma builds REST or HTTP RPC APIs in Go with declarative routes, validation, and automatically maintained OpenAPI 3.1 and JSON Schema docs.
Overview
Huma is a Go micro-framework for HTTP REST and RPC-style APIs that centers on OpenAPI 3.1 and JSON Schema. You attach it to a router you already use—Chi, the Go 1.22+ standard mux, or others—and describe operations, models, parameters, bodies, and responses in Go types.
The framework generates schemas from those types, validates incoming data, handles errors consistently, and documents headers and response shapes. Features include conditional request helpers, optional automatic PATCH operations, per-operation body size limits, startup hooks, graceful shutdown, and a small built-in CLI for port and configuration via flags or environment variables.
Generated OpenAPI stays aligned with the live routes so SDK generators, Swagger UI, and schema-aware editors can rely on it. JSON Schema for resources can surface through describedby links or inline schema properties on responses.
The project targets teams that want incremental adoption: document and harden existing services, bring custom middleware and metrics, and avoid documentation drift compared with hand-maintained specs.
Key features
- OpenAPI 3.1 generation
- JSON Schema from Go types
- Bring-your-own HTTP router
- Automatic request validation
- Declarative operation definitions
- Optional PATCH generation
- Built-in CLI and graceful shutdown
- Conditional request utilities
Use cases
- New Go REST services
- Documenting legacy Go routes
- Schema-validated HTTP APIs
- OpenAPI-driven client generation