jsonschema

package
v0.82.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

NOTE:

This package primarily exists for Wave's JSON schema generation. It does not -- and probably won't ever -- cover the entire JSON schema spec (or anywhere near it).

Buyer beware.

Index

Constants

View Source
const (
	TypeObject  = "object"
	TypeString  = "string"
	TypeBoolean = "boolean"
	TypeArray   = "array"
	TypeNumber  = "number"
)

Variables

This section is empty.

Functions

func UniqueFrom

func UniqueFrom(strs ...string) string

Types

type Def

type Def struct {
	Type                string
	Required            bool
	Description         string
	DescriptionOverride string
	Examples            []string
	Default             any
	RequiredChildren    []string
	Properties          any
	AllOf               []any
	Items               Entry
	Enum                []string
}

type Entry

type Entry struct {
	Schema      string   `json:"$schema,omitempty"`
	Type        string   `json:"type"`
	Description string   `json:"description,omitempty"`
	Default     any      `json:"default,omitempty"`
	Required    []string `json:"required,omitempty"`
	AllOf       []any    `json:"allOf,omitempty"`
	Properties  any      `json:"properties,omitempty"`
	Items       any      `json:"items,omitempty"`
	Enum        []string `json:"enum,omitempty"`
	Examples    []string `json:"examples,omitempty"`
}

func ObjectWithOverride

func ObjectWithOverride(override string, sd Def) Entry

func OptionalArray

func OptionalArray(sd Def) Entry

func OptionalBoolean

func OptionalBoolean(sd Def) Entry

func OptionalNumber

func OptionalNumber(sd Def) Entry

func OptionalObject

func OptionalObject(sd Def) Entry

func OptionalString

func OptionalString(sd Def) Entry

func RequiredArray

func RequiredArray(sd Def) Entry

func RequiredBoolean

func RequiredBoolean(sd Def) Entry

func RequiredObject

func RequiredObject(sd Def) Entry

func RequiredString

func RequiredString(sd Def) Entry

func ToJSONSchema

func ToJSONSchema(sd Def) Entry

type IfThen

type IfThen struct {
	If   any `json:"if,omitempty"`
	Then any `json:"then,omitempty"`
}

Jump to

Keyboard shortcuts

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