Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Generator ¶
type Generator struct {
Reflector *jsonschema.Reflector
LookupCommentFunc LookupCommentFunc
Tests bool // Include test files.
// contains filtered or unexported fields
}
Generator generates a JSON schema from a Go type using reflection. It looks up comments from the source code to provide documentation, one or more package paths are provided. Uses github.com/invopop/jsonschema.
func NewGenerator ¶
NewGenerator creates a new Generator. The reflectTarget is the Go type to generate the schema for, and packagePaths are the fully qualified import paths of the packages to lookup comments from.
type LookupCommentFunc ¶
type ValidationError ¶
type ValidationError struct {
Path *yaml.Path // YAML path to the validation error.
Err error // Underlying error.
Field string // Field name that failed validation.
Detail string // Detailed error message.
}
ValidationError represents a validation error from JSON schema validation. It wraps the original validation result and provides path information for yaml.Path.AnnotateSource.
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates data against a JSON schema. Uses github.com/santhosh-tekuri/jsonschema/v6.
func NewValidator ¶
NewValidator creates a new Validator with the provided JSON schema data.
func (*Validator) Validate ¶
ValidateWithSchema validates the given data against the schema. It returns a ValidationError that can be used with yaml.Path.AnnotateSource for precise error reporting.