Help us shape the future of Go! Take the 2026 Go Developer Survey

jsonschema

package
v0.41.0 Latest Latest
Warning

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

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

Documentation

Overview

Package jsonschema generates TypeScript schema declarations from JSON Schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Declarations

func Declarations(ctx context.Context, config Config) (string, error)

Declarations renders the types the configured schemas describe as one TypeScript declaration file for the configured module.

func WriteDeclarations

func WriteDeclarations(ctx context.Context, config Config, output string) error

WriteDeclarations renders the declarations for config into the file at output.

Types

type Config

type Config struct {
	// Module names the declared module, which scripts import the types from.
	Module string `required:"" placeholder:"NAME" help:"Name of the TypeScript module to declare the types in."`
	// Schemas are JSON Schema files whose titled roots and definitions become types.
	Schemas []string `` /* 142-byte string literal not displayed */
}

Config selects the JSON Schema files declared as one TypeScript module.

func (Config) Validate

func (c Config) Validate() error

Validate checks that the configuration names a module and at least one schema.

Jump to

Keyboard shortcuts

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