testutil

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateGithubAction

func ValidateGithubAction(t *testing.T, data []byte, isAction bool) error

ValidateGithubAction validates a GitHub Actions YAML file using action-validator. If it conforms to GitHub actions spec, no error will be returned.

Ref: https://github.com/mpalmer/action-validator

func ValidateYAML

func ValidateYAML(t *testing.T, data []byte) error

ValidateYAML checks whether the bytes contain valid YAML syntax.

Types

type SchemaValidator

type SchemaValidator struct {
	// contains filtered or unexported fields
}

SchemaValidator wraps a compiled JSON Schema for validation.

func SchemaFromBytes

func SchemaFromBytes(t *testing.T, data []byte) (*SchemaValidator, error)

SchemaFromBytes compiles a JSON Schema from a byte slice.

func SchemaFromURL

func SchemaFromURL(t *testing.T, url string) (*SchemaValidator, error)

SchemaFromURL fetches a JSON Schema from the given URL and compiles it.

func (*SchemaValidator) Validate

func (v *SchemaValidator) Validate(data any) error

Validate validates any data against the schema.

func (*SchemaValidator) ValidateJSON

func (v *SchemaValidator) ValidateJSON(jsonData []byte) error

ValidateJSON validates JSON bytes against the schema.

func (*SchemaValidator) ValidateMap

func (v *SchemaValidator) ValidateMap(data map[string]any) error

ValidateMap validates a map against the schema.

func (*SchemaValidator) ValidateYAML

func (v *SchemaValidator) ValidateYAML(yamlData []byte) error

ValidateYAML validates YAML bytes against the schema.

Jump to

Keyboard shortcuts

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