https://github.com/faustbrian/go-validation
Typed, deterministic, transport-neutral validation for Go applications.
https://github.com/faustbrian/go-validation
api data-validation go golang http json-api json-rpc security validation validator
Last synced: 5 days ago
JSON representation
Typed, deterministic, transport-neutral validation for Go applications.
- Host: GitHub
- URL: https://github.com/faustbrian/go-validation
- Owner: faustbrian
- License: mit
- Created: 2026-07-16T07:28:31.000Z (9 days ago)
- Default Branch: main
- Last Pushed: 2026-07-17T02:04:56.000Z (9 days ago)
- Last Synced: 2026-07-17T03:07:44.076Z (8 days ago)
- Topics: api, data-validation, go, golang, http, json-api, json-rpc, security, validation, validator
- Language: Go
- Size: 91.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: docs/security.md
Awesome Lists containing this project
README
# go-validation
`go-validation` is a typed, transport-neutral validation package for Go 1.26
and later. Ordinary functions and `Validator[T]` are the primary API. Reports
retain stable paths and rule codes without retaining rejected values.
## Five-minute quickstart
```go
package main
import (
"fmt"
validation "github.com/faustbrian/go-validation"
"github.com/faustbrian/go-validation/rules"
)
func main() {
ctx, _ := validation.NewContext(validation.DefaultLimits())
validator := validation.All(validation.CollectAll,
rules.RuneLength(3, 40),
rules.Prefix("usr_"),
)
report := validator.Validate(ctx.WithPath(validation.Field("username")), "x")
for _, violation := range report.Violations() {
fmt.Println(violation.Path(), violation.Code())
}
// Output:
// username rune_length
// username prefix
}
```
Use `validation.Value[T]` when input presence matters:
```go
missing := validation.Missing[string]()
null := validation.Null[string]()
empty := validation.Present("")
_ = []validation.Value[string]{missing, null, empty}
```
Core validators never perform I/O. Use `AsyncValidator[T]` and `AsyncAll` for
context-aware external checks. Reflection is optional and isolated in
`structplan`; typed plans require no tags or registry.
## Documentation
- [Documentation index](docs/README.md)
- [API and packages](docs/api.md)
- [Rule catalog](docs/rules.md)
- [Normative semantics](docs/semantics.md)
- [Guides](docs/guides.md)
- [Security model](docs/security.md)
- [Hardening evidence](docs/hardening-report.md)
- [Laravel and cline/struct adoption](docs/adoption.md)
- [Compatibility](docs/compatibility.md)
## Local verification
```sh
make check
```
Every blocking CI command has a local Make target. `make nilaway` is advisory.
Hosted CI is a release integrator's final external verification step, not a
prerequisite for local development.
## License
MIT. See [LICENSE](LICENSE).