
Validate HTTP input data in a fancy way.
👑 Written in Nim language
nimble install bag
- Macro-based webform validation
- Framework agnostic
- i18n support
- Based on Valido package
- Open Source |
MITLicense - Written in 👑 Nim language
let data = @[
("email", "test@example.com"),
("password", "abc"),
("message", "Hello world")
]
withBag data:
email: tEmail"auth.error.email"
password: tPasswordStrength"weak.password"
message: tTextarea"msg.empty":
min: 10 or "msg.too.short"
max: 500 or "msg.too.long"
*remember: tCheckbox # optional, default false
csrf -> callback do(input: string) -> bool:
result = validateToken("/auth/login", input)
do:
if inputBag.isInvalid:
for (field, err) in inputBag.getErrors:
echo field, ": ", i18n(err)See the full test suite for all 30+ supported field types.
- 🐛 Found a bug? Create a new Issue
- 👋 Wanna help? Fork it!
Bag | MIT license. Made by Humans from OpenPeeps.
Copyright © OpenPeeps & Contributors — All rights reserved.