schema

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package schema provides JSON Schema generation for CLI output types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(v any) error

Print outputs the JSON Schema for the given type

func PrintCommandSchema

func PrintCommandSchema(command, description string, v any) error

PrintCommandSchema outputs schema with command metadata

Types

type CommandSchema

type CommandSchema struct {
	Command     string      `json:"command"`
	Description string      `json:"description"`
	Output      *JSONSchema `json:"output"`
}

CommandSchema holds schema information for a CLI command

type JSONSchema

type JSONSchema struct {
	Schema      string                 `json:"$schema,omitempty"`
	Type        string                 `json:"type,omitempty"`
	Description string                 `json:"description,omitempty"`
	Properties  map[string]*JSONSchema `json:"properties,omitempty"`
	Items       *JSONSchema            `json:"items,omitempty"`
	Required    []string               `json:"required,omitempty"`
	Enum        []string               `json:"enum,omitempty"`
	Format      string                 `json:"format,omitempty"`
	Nullable    bool                   `json:"nullable,omitempty"`
}

JSONSchema represents a JSON Schema document

func Generate

func Generate(v any) *JSONSchema

Generate creates a JSON Schema from a Go type

Jump to

Keyboard shortcuts

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