validate

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package validate provides validation capabilities for OpenCLI specification documents. It performs both JSON Schema validation and logical constraint checking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateJSON

func ValidateJSON(data []byte) error

ValidateJSON validates a JSON-encoded OpenCLI spec document against the JSON Schema and applies additional logical checks.

For example:

data, _ := os.ReadFile("my-cli.ocs.json")
if err := validate.ValidateJSON(data); err != nil {
    log.Fatal(err)
}

func ValidateYAML

func ValidateYAML(data []byte) error

ValidateYAML validates a YAML-encoded OpenCLI spec document against the JSON Schema and applies additional logical checks.

For example:

data, _ := os.ReadFile("my-cli.ocs.yaml")
if err := validate.ValidateYAML(data); err != nil {
    log.Fatal(err)
}

Types

type ValidationError

type ValidationError struct {
	Message string
	Path    string
}

ValidationError describes a logical constraint violation detected during spec validation, beyond what JSON Schema can express.

Message holds the human-readable description of the problem. Path indicates where in the spec the violation occurred, using dot-notation keys (e.g. "commands.deploy.arguments"). An empty path means the error is global and not tied to a specific node.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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