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 ¶
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 ¶
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 ¶
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