Features¶
The map of valigo, in the order of the menu.
Configuration¶
How the rules are configured and composed.
| Page | What's inside |
|---|---|
| Validator and Configure | New and its options, Configure, the model, field pointers, nested and recursive structs |
| Types and conversions | Field, Slice, Map and As, the built-in conversions, conversions of your types |
| Absent values | nil pointers, nil slices and nil nested structs: which rules skip them |
| Conditions | When on the struct and on a field, conditional requiredness |
| Custom rules | Custom on a field, on a slice and on the struct, rules with limits from data |
| Rules on other fields | EqualField, MinField, MaxField, BeforeField, AfterField by the pointer of the other field |
| Rules from tags | Tags: the tags of go-playground/validator, validate:"required,max=64", for a migration |
Rules¶
The built-in rules of every type.
| Page | What's inside |
|---|---|
| Strings | str.Of: lengths, AnyOf, substrings, Regexp, Email, URL, IP, CIDR, MAC, Hostname, UUID, E164, Base64, JSON, Semver, Datetime, ISO codes, CreditCard, Trim |
| Numbers | num.Of, num.Ptr: Required, Min, Max, AnyOf, AnyOfInterval, Latitude, Longitude |
| Time | timex.Of: Required, Before, After, Between, InPast, InFuture |
| Comparable values | eq.Of, eq.Ptr, eq.Slice: enums, bools — OneOf, NotOneOf, Equal, NotEqual, Unique |
| UUID | uuid.Of of the separate module: Required, AnyOf |
| Slices | Slice and the slice conversions: length rules, Each for the elements |
| Maps | Map: length rules, EachKey and EachValue with conversions |
Errors¶
What a validation returns.
| Page | What's inside |
|---|---|
| Errors | Validate and ValidateTyped, shared.Error, locations, codes for clients, errors transformer |
| Translations | built-in locales, plural forms, own messages, languages from the context, Accept-Language middleware |
| HTTP problem details | problem: the errors as application/problem+json of RFC 9457 with JSON pointers and codes |
Integrations¶
The separate modules for the frameworks.
| Page | What's inside |
|---|---|
| JSON Schema | the rules as the keywords of JSON Schema for the generators of API schemas, Constraints |
| huma | github.com/insei/valigo/integrations/huma: the rules in the Resolve of huma inputs with the locations of huma and in its OpenAPI document |
| gin | github.com/insei/valigo/integrations/gin: the binding.StructValidator of gin and validation with the language of the request |
| go-i18n | github.com/insei/valigo/integrations/goi18n: the messages from a bundle of go-i18n, the built-in ones for the rest |
| echo | github.com/insei/valigo/integrations/echo: the echo.Validator and validation with the language of the request |