schema

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSchemaLoader is returned when json schema cannot be loaded properly.
	ErrSchemaLoader = errors.New("schema loader error")
	// ErrValidate is returned when data validation founds errors.
	ErrValidate = errors.New("validation error")
	// ErrYamlToJSON is returned when yaml cannot be converted to json.
	ErrYamlToJSON = errors.New("yaml to json conversion error")
)

Functions

This section is empty.

Types

type Data

type Data struct {
	Added      []string `json:"added"      yaml:"added"`
	Changed    []string `json:"changed"    yaml:"changed"`
	Deprecated []string `json:"deprecated" yaml:"deprecated"`
	Removed    []string `json:"removed"    yaml:"removed"`
	Fixed      []string `json:"fixed"      yaml:"fixed"`
	Security   []string `json:"security"   yaml:"security"`
}

Data for single changelog section and single change-file.

func ParseJSON

func ParseJSON(bytes []byte) (*Data, error)

ParseJSON takes a JSON byte slice and validates it against the JSON Schema. It returns a Data struct if the JSON is valid.

func ParseYAML

func ParseYAML(bytes []byte) (*Data, error)

ParseYAML takes a YAML byte slice and validates it against the JSON Schema. It returns a Data struct if the YAML is valid.

func (*Data) IsEmpty

func (d *Data) IsEmpty() bool

IsEmpty returns true if all fields are empty.

Jump to

Keyboard shortcuts

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