codec

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatCheckReport

func FormatCheckReport(report CheckReport) (string, error)

func FormatFileCheckReports

func FormatFileCheckReports(reports []FileCheckReport) (string, error)

func ImportJSON

func ImportJSON(input string) (string, error)

func ImportJSONFile

func ImportJSONFile(path string) (string, error)

func ImportJSONSchema

func ImportJSONSchema(input string) (string, error)

func ImportTOML

func ImportTOML(input string) (string, error)

func ImportYAML

func ImportYAML(input string) (string, error)

func Marshal

func Marshal(value any) (string, error)

func MarshalOutput

func MarshalOutput(value any) (string, error)

func OutputMap

func OutputMap(result Result) map[string]any

func Unmarshal

func Unmarshal(input string, target any) error

func UnmarshalWithInjections

func UnmarshalWithInjections(input string, injections map[string]any, target any) error

func UnmarshalWithInput

func UnmarshalWithInput(input string, values map[string]any, target any) error

Types

type CheckIssue

type CheckIssue struct {
	Path     string `json:"path"`
	Reason   string `json:"reason"`
	Format   string `json:"format"`
	Key      string `json:"key,omitempty"`
	Line     int    `json:"line,omitempty"`
	Column   int    `json:"column,omitempty"`
	Actual   string `json:"actual,omitempty"`
	Expected string `json:"expected,omitempty"`
}

type CheckReport

type CheckReport struct {
	Syntax                   []CheckIssue `json:"syntax"`
	KeyIncompatibility       []CheckIssue `json:"key_incompatibility"`
	TypeIncompatibility      []CheckIssue `json:"type_incompatibility"`
	StructureIncompatibility []CheckIssue `json:"structure_incompatibility"`
}

func CheckJSON

func CheckJSON(input string) CheckReport

func CheckTOML

func CheckTOML(input string) CheckReport

func CheckYAML

func CheckYAML(input string) CheckReport

func (CheckReport) HasIssues

func (report CheckReport) HasIssues() bool

type FileCheckReport

type FileCheckReport struct {
	Path   string      `json:"path"`
	Format string      `json:"format"`
	Errors CheckReport `json:"errors"`
}

func CheckFile

func CheckFile(path string) (FileCheckReport, error)

type Result

type Result struct {
	Data   map[string]any
	Schema map[SchemaField]SchemaType
}

func Parse

func Parse(input string) (Result, error)

func ParseFile

func ParseFile(path string) (Result, error)

func ParseFileWithInjections

func ParseFileWithInjections(path string, injections map[string]any) (Result, error)

func ParseFileWithInput

func ParseFileWithInput(path string, values map[string]any) (Result, error)

func ParseWithInjections

func ParseWithInjections(input string, injections map[string]any) (Result, error)

func ParseWithInput

func ParseWithInput(input string, values map[string]any) (Result, error)

type SchemaField

type SchemaField struct {
	Name     string
	Optional bool
}

type SchemaType

type SchemaType struct {
	Kind    SchemaTypeKind
	Name    string
	Element *SchemaType
	Fields  map[SchemaField]SchemaType
	Members []SchemaType
}

type SchemaTypeKind

type SchemaTypeKind int
const (
	SchemaTypeUnknown SchemaTypeKind = iota
	SchemaTypePrimitive
	SchemaTypeNamed
	SchemaTypeArray
	SchemaTypeRecord
	SchemaTypeUnion
	SchemaTypeVariant
	SchemaTypeRecordMap
)

Jump to

Keyboard shortcuts

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