DEV.co
AI Coding Agents · omissis

go-jsonschema

go-jsonschema is a Go tool that automatically generates Go structs and unmarshalling code from JSON Schema definitions. It eliminates manual struct definition and includes validation logic based on the schema rules.

Source: GitHub — github.com/omissis/go-jsonschema
796
GitHub stars
132
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryomissis/go-jsonschema
Owneromissis
Primary languageGo
LicenseMIT — OSI-approved
Stars796
Forks132
Open issues77
Latest releasev0.23.1 (2026-05-09)
Last updated2026-07-08
Sourcehttps://github.com/omissis/go-jsonschema

What go-jsonschema is

A code generator written in Go that parses JSON Schema and emits strongly-typed Go data structures with embedded validation during unmarshalling. Supports multiple schemas in a single run, cross-file schema references, and semantic types for dates and times.

Quickstart

Get the go-jsonschema source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/omissis/go-jsonschema.gitcd go-jsonschema# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

API Request/Response Validation

Generate type-safe Go structs from OpenAPI/JSON Schema definitions, ensuring incoming requests and outgoing responses conform to contract with built-in unmarshalling validation.

Configuration File Parsing

Define configuration schemas and auto-generate Go types with validation, reducing boilerplate and minimizing configuration parsing bugs.

Data Pipeline Type Safety

Generate Go types from JSON data schemas to ensure type safety across ETL, data ingestion, or event processing pipelines with automatic validation.

Implementation considerations

  • Requires Go 1.25+ per badge. Verify your team's Go version before adoption.
  • Generator outputs to stdout by default; integrate into build pipeline with output redirection or flag-based file writing for multiple schemas.
  • Generated unmarshalling validates per schema; ensure error handling strategy for validation failures is defined.
  • Cross-schema references (external files) and nested $defs support is partial; test complex schema structures before committing.
  • Special types (SerializableDate, SerializableTime) add dependencies; review custom type requirements and JSON marshalling behavior.

When to avoid it — and what to weigh

  • Incomplete JSON Schema Coverage Needed — Project still lacks support for boolean subschemas (allOf, anyOf, oneOf, not), conditional schemas (if/then/else), and nested location identifiers. Check validation status in README against your schema requirements.
  • Highly Dynamic or Weakly-Typed Requirements — If your use case requires json.Number or highly flexible untyped data handling, current implementation does not offer the option for numeric types beyond native Go numbers.
  • Custom Semantic Format Support Required — Only dates, times, and basic formats are supported. Email, hostname, IP address, URI, and regex formats are not yet implemented.
  • Heavy Customization of Generated Code — Code generation is deterministic and schema-driven; if you need significant post-generation modifications or hand-tuned code, maintenance burden increases.

License & commercial use

MIT License. Permissive OSI-approved license allowing commercial use, modification, and distribution with attribution.

MIT is a permissive license. Commercial use is permitted, provided license and copyright notice are retained in distributed software or documentation. No warranties or indemnification; review with legal if risk profile requires liability coverage.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

As a code generator, security depends on: (1) schema source integrity—malicious schemas could generate unexpected code; validate schema inputs. (2) Generated code validation—unmarshalling includes schema-driven checks, but incomplete validation coverage (missing allOf, anyOf, oneOf) may leave gaps. (3) No identified published vulnerabilities; review recent commits and GitHub security advisories.

Alternatives to consider

quicktype (Go target)

Multi-language code generator with broader schema support and stronger IDE integration. Supports more JSON Schema drafts and output languages (Go, Rust, TypeScript, etc.).

easyjson / manual structs

Manual struct definition with easyjson for fast marshalling. Lower automation but simpler debugging and full control over generated code.

go-swagger (OpenAPI)

Specialized for OpenAPI/Swagger specs with richer API documentation integration. Heavier than go-jsonschema but widely used in enterprise API projects.

Software development agency

Build on go-jsonschema with DEV.co software developers

Evaluate go-jsonschema for your schema-driven code generation needs. Review the validation feature matrix in the README, test against your schemas, and consider incomplete support for advanced schema features before committing.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

go-jsonschema FAQ

Does go-jsonschema validate JSON at runtime or just generate types?
Both. It generates Go structs and unmarshalling code that includes validation logic according to the schema rules (e.g., min/max, pattern, enum). Validation happens during JSON unmarshalling.
Can I use go-jsonschema for OpenAPI schemas?
Yes, if you export the JSON Schema from your OpenAPI spec. However, go-jsonschema does not parse OpenAPI metadata (operationId, paths, etc.). For full OpenAPI integration, consider go-swagger.
What happens if my JSON Schema uses unsupported features (allOf, anyOf, etc.)?
The tool may skip or partially handle them. Check the validation status in the README. Unsupported features will either be ignored or cause generation errors. Always test generated code against your schema.
Is the generated code guaranteed to be production-ready?
Generated code is type-safe and includes validation, but incomplete feature coverage means some validation rules may not be enforced. Review generated code and test against representative data before production use.

Work with a software development agency

Adopting go-jsonschema is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate ai coding agents software in production.

Ready to streamline your Go API validation?

Evaluate go-jsonschema for your schema-driven code generation needs. Review the validation feature matrix in the README, test against your schemas, and consider incomplete support for advanced schema features before committing.