JSON Schema

Provides a representation of JSON Schema files and utilities for working with them

Technology

The jsonschema module provides comprehensive JSON Schema support for Project Forge applications. It offers a complete Go representation of JSON Schema Draft 2020-12 with validation utilities and collection management.

Overview

This module provides:

Key Features

JSON Schema Compliance

Schema Management

Developer Experience

Package Structure

Core Components

Usage Examples

Basic Schema Creation

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
schema := &jsonschema.Schema{
Type: "object",
Title: "User Schema",
Description: "Schema for user objects",
Properties: map[string]*jsonschema.Schema{
"name": {
Type: "string",
MinLength: util.IntPtr(1),
},
"age": {
Type: "integer",
Minimum: util.IntPtr(0),
},
},
Required: []string{"name"},
}

Schema Collection Management

1
2
3
4
5
collection := jsonschema.NewCollection()
collection.Add("user", userSchema)
collection.Add("product", productSchema)

userSchema := collection.Get("user")

Source Code

See Also