github.com/kaptinlin/jsonschema@v0.4.6/examples/README.md (about)

     1  # Examples
     2  
     3  Practical examples demonstrating JSON Schema validation and unmarshaling with the new separated workflow.
     4  
     5  ## Available Examples
     6  
     7  ### 🎯 [Basic](./basic/)
     8  Simple validation example showing valid and invalid data handling.
     9  
    10  ### 🏗️ [Struct Validation](./struct-validation/)
    11  Direct struct validation without JSON marshaling for optimal performance.
    12  
    13  ### 🔄 [Multiple Input Types](./multiple-input-types/)
    14  Handle different data types (JSON bytes, maps, structs) with type-specific methods.
    15  
    16  ### 📦 [Unmarshaling](./unmarshaling/)
    17  Validation + unmarshaling workflow with default value application.
    18  
    19  ### ⚙️ [Dynamic Defaults](./dynamic-defaults/)
    20  Dynamic default value generation using registered functions (e.g., timestamps, UUIDs).
    21  
    22  ### 📋 [Custom Formats](./custom-formats/)
    23  Custom format validation using registered functions.
    24  
    25  ### ⚠️ [Error Handling](./error-handling/)
    26  Comprehensive error handling patterns and validation failure management.
    27  
    28  ### 🌍 [Internationalization](./i18n/)
    29  Multilingual error messages using Chinese (zh-Hans) and English locales.
    30  
    31  ### 🏗️ [Constructor](./constructor/)
    32  Schema creation using fluent constructor API with keywords and validation.
    33  
    34  ## Running Examples
    35  
    36  ```bash
    37  # Run any example
    38  cd <example-directory>
    39  go run main.go
    40  
    41  # Or run from project root (for single-file examples)
    42  go run examples/<example-name>/main.go
    43  
    44  # For dynamic defaults example
    45  cd examples/dynamic-defaults
    46  go run dynamic_defaults.go
    47  ```