advanced-struct

command
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2025 License: MIT Imports: 5 Imported by: 0

README

Advanced Struct Validation

This example demonstrates validation of nested Go structs with JSON Schema, showcasing complex object hierarchies and advanced validation features.

Running the Example

go run examples/advanced-struct/main.go

Structure Overview

type User struct {
    ID       int64     `json:"id"`
    Username string    `json:"username"`
    Email    string    `json:"email"`
    Age      *int      `json:"age,omitempty"`    // Optional field
    Address  Address   `json:"address"`          // Nested struct
    Tags     []string  `json:"tags,omitempty"`
    CreatedAt time.Time `json:"created_at"`
}

type Address struct {
    Street  string `json:"street"`
    City    string `json:"city"`
    Country string `json:"country"`
    ZipCode string `json:"zip_code,omitempty"`
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL