spec

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Name     string            `yaml:"name"`
	Code     string            `yaml:"code"`
	Key      string            `yaml:"key"`
	HTTP     int               `yaml:"http"`
	Args     []string          `yaml:"args"`
	Messages map[string]string `yaml:"messages"`
}

Error defines a single error entry in the schema.

type GenOptions

type GenOptions struct {
	SchemaFile string
	OutDir     string
	LocalesDir string
}

GenOptions holds the options passed to a Generator.

type Generator

type Generator interface {
	// Lang returns the language identifier, e.g. "go", "typescript".
	Lang() string
	// Generate produces output files from the parsed schema.
	Generate(schema Schema, opts GenOptions) error
}

Generator is the interface implemented by each language backend. Adding support for a new language means implementing this interface.

type Schema

type Schema struct {
	Package    string                       `yaml:"package"`
	Errors     []Error                      `yaml:"errors"`
	Validators map[string]map[string]string `yaml:"validators"`
}

Schema is the top-level structure of an error schema YAML file.

Jump to

Keyboard shortcuts

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