schema

package
v1.1.0 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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