jsonschema-validating

Validate Go structs, maps, and JSON payloads against JSON Schema Draft 2020-12 with detailed error reporting and defaults during unmarshalling.

23|2|Updated Jun 9, 2025
One-click install
npx skills add https://github.com/kaptinlin/gozod --skill jsonschema-validating
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jsonschema-validating
Source: https://github.com/kaptinlin/gozod/tree/main/.agents/skills/jsonschema-validating
Command: npx skills add https://github.com/kaptinlin/gozod --skill jsonschema-validating

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Validate Go data against JSON Schema Draft 2020-12 using github.com/kaptinlin/jsonschema to ensure contract compliance and data integrity across APIs and services.

Core Features & Use Cases

  • Compile JSON schemas from JSON, bytes, or Go structs using programmatic constructors and FromStructT.
  • Validate data: support for JSON strings, Go structs, and maps with detailed error reporting.
  • Unmarshal validated data into Go destinations with defaults applied, enabling safe data hydration across boundaries.
  • Easily generate schemas from struct tags and programmatic definitions for scalable validation strategies.

Quick Start

Import github.com/kaptinlin/jsonschema and start by compiling a schema, then validate your Go data against it.

Frequently Asked Questions about jsonschema-validating

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate Go data against a JSON Schema?

You validate Go data against JSON Schema by compiling a schema from JSON, bytes, or Go structs, then applying it to validate JSON strings, Go structs, and maps with detailed error reporting.

Can I generate a JSON Schema from Go struct tags?

Yes, you can generate JSON Schemas from Go struct tags using the FromStruct[T]() method or programmatic constructors, enabling scalable validation strategies without manually writing schema files.

How do I unmarshal JSON into Go structs with defaults applied?

You unmarshal validated JSON into Go destinations with defaults applied during the process, ensuring safe data hydration and strict type safety across API and service boundaries.

What's the best way to enforce strict type safety during JSON unmarshalling in Go?

Enforce strict type safety by validating data against JSON Schema Draft 2020-12 before unmarshalling, which checks contract compliance and provides detailed error reporting for invalid payloads.

Does JSON Schema Draft 2020-12 support validating Go maps and structs?

Yes, JSON Schema Draft 2020-12 validation supports validating Go maps, structs, and JSON strings, allowing you to verify data integrity across multiple input types programmatically.

Why am I getting validation errors when unmarshalling JSON payloads in Go?

Validation errors occur when JSON payloads fail to comply with the compiled JSON Schema constraints, and the system provides detailed error reporting to identify the exact property violations.