<commit_before>package jsval

// Package jsval implements an input validator, based on JSON Schema.
// The main purpose is to validate JSON Schemas (see
// https://github.com/lestrrat/go-jsschema), and to automatically
// generate validators from schemas, but jsval can be used independently
// of JSON Schema.

import (
	"errors"

	"github.com/lestrrat/go-pdebug"
)

// New creates a new JSVal instance.
func New() *JSVal {
	return &JSVal{
		refs: make(map[string]Constraint),
	}
}

// Validate validates the input, and return an error
// if any of the validations fail
func (v *JSVal) Validate(x interface{}) error {
	return v.root.Validate(x)
}

// SetRoot sets the root Constraint object.
func (v *JSVal) SetRoot(c Constraint) {
	v.root = c
}

// Root returns the root Constraint object.
func (v *JSVal) Root() Constraint {
	return v.root<commit_msg>move stuff to appease godoc.org<commit_after>// Package jsval implements an input validator, based on JSON Schema.
// The main purpose is to validate JSON Schemas (see
// https://github.com/lestrrat/go-jsschema), and to automatically
// generate validators from schemas, but jsval can be used independently
// of JSON Schema.
package jsval

import (
	"errors"

	"github.com/lestrrat/go-pdebug"
)

// New creates a new JSVal instance.
func New() *JSVal {
	return &JSVal{
		refs: make(map[string]Constraint),
	}
}

// Validate validates the input, and return an error
// if any of the validations fail
func (v *JSVal) Validate(x interface{}) error {
	return v.root.Validate(x)
}

// SetRoot sets the root Constraint object.
func (v *JSVal) SetRoot(c Constraint) {
	v.root = c
}

// Root returns the root Constraint object.
func (v *JSVal) Root() Constraint {
	return v.root
{'fraction_non_alphanumeric': 0.10956521739130434, 'fraction_numerical': 0.0, 'mean_word_length': 3.8077994428969357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2506646', 'n_tokens_mistral': 560, 'n_tokens_neox': 559, 'n_words': 208}