Skip to content

Commit

Permalink
add package docs
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Nov 21, 2024
1 parent c3ec65f commit 140db5f
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions valdo/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// The main functions are:
//
// - [Validate] validates the given JSON using the validator.
// - [Unmarshal] validates the JSON and unmarshals it into the given type.
// - [Schema] generates JSON Schema for the validator.
//
// # Types
//
// The top-level validator defines the type of the data.
// It can be a primitive type, a collection, or a composition
// of multiple types.
//
// - Primitive types: [Bool], [Float64], [Int], [String], [Null], [Any].
// - Collections: [Array], [Object], [Map]
// - Composition: [AllOf], [Not]
//
// # Constraints
//
// The types also accept a number of constraints. Either
// as an argument of their constructor or as Constrain method.
//
// - Numeric constraints: [ExclMax], [ExclMin], [Max], [Min], [MultipleOf]
// - String constraints: [MaxLen], [MinLen], [Pattern]
// - Object constraints: [MaxProperties], [MinProperties], [PropertyNames]
// - Array constraints: [Contains], [MaxItems], [MinItems]
//
// # Errors
//
// [Validate] returns one of the following errors:
//
// - [Errors]
// - [ErrNoInput]
// - [ErrProperty]
// - [ErrIndex]
// - [ErrType]
// - [ErrRequired]
// - [ErrUnexpected]
// - [ErrNot]
//
// Or one of the constraint errors:
//
// - [ErrMultipleOf]
// - [ErrMin]
// - [ErrExclMin]
// - [ErrMax]
// - [ErrExclMax]
// - [ErrMinLen]
// - [ErrMaxLen]
// - [ErrPattern]
// - [ErrContains]
// - [ErrMinItems]
// - [ErrMaxItems]
// - [ErrPropertyNames]
// - [ErrMinProperties]
// - [ErrMaxProperties]
//
// The errors can be translated using [Locale].
// Multiple locales can be combined in a single registry
// using [Locales].
package valdo

0 comments on commit 140db5f

Please sign in to comment.