dto-validation-design
CommunityDesign and validate API DTOs with confidence.
System Documentation
What problem does it solve?
Guides design of request/response DTOs, field-level and cross-field validation, and input sanitization for Go 1.26+ APIs in a multi-tenant platform. DTOs serve two roles: HTTP request/response types for the API Gateway's external endpoints, and NATS message payloads (MsgPack-serialized) for inter-service communication. Covers go-playground/validator struct tags (required, min, max, oneof, uuid), custom cross-field validators, DTO-to-domain model mapping functions, standard MsgPack response envelope with error codes, cursor-based pagination DTOs, CloudEvents envelope (MsgPack-serialized) for NATS JetStream messages, and XSS/HTML sanitization patterns. Produces implementation-ready Go struct definitions with validation tags and mapping functions for PostgreSQL 18 backed services.
Core Features & Use Cases
- HTTP and NATS DTO definitions separated by clear mapping functions.
- Validation tags for required, min, max, oneof, uuid, plus cross-field validators.
- DTO-to-domain mapping, with tenant context and input sanitization.
- Standard envelopes: MsgPack CloudEvents for NATS, pagination DTOs, and error handling patterns.
- Security-ready input sanitization patterns (XSS prevention) for API inputs.
Quick Start
Define HTTP and NATS DTO structs, implement ToDomain mappings, and plug in validation and sanitization to produce production-ready Go types.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: dto-validation-design Download link: https://github.com/PremModhaOfficial/motadata-ai-pipeline/archive/main.zip#dto-validation-design Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.