schema

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package schema generates and renders JSON schemas from Go API types.

Index

Constants

This section is empty.

Variables

View Source
var (
	SchemaDir      = "schema"
	SchemaEmbedDir = filepath.Join("pkg", "schema", "embedded")
	SchemaDocsDir  = "docs/schema"
)

Where the generated schemas, their embedded copies, and their docs are written.

Functions

func GenerateDocs

func GenerateDocs() error

GenerateDocs renders docs/schema/*.md from the reflected Go structs.

func GenerateSchemas

func GenerateSchemas() error

GenerateSchemas creates the jsonschema files under schema/ and pkg/schema/embedded/.

func GenerateV1Alpha1Schema

func GenerateV1Alpha1Schema(v any, path []string, key func(string) string) ([]byte, error)

GenerateV1Alpha1Schema reflects a struct into JSON Schema bytes.

Types

type Target

type Target struct {
	SchemaStruct any
	SchemaPath   string
	StructPath   []string
	KeyNamer     func(string) string
	DocTitle     string
	DocFile      string
}

Target describes a schema generation target.

func Targets

func Targets() []Target

Targets returns the canonical list of structs published as JSON schemas.

Jump to

Keyboard shortcuts

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