Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/openpeeps/bag

Validate form input data in a fancy way. Written in Nim language
https://github.com/openpeeps/bag

bag form form-validation input-validation nim-lang

Last synced: about 2 months ago
JSON representation

Validate form input data in a fancy way. Written in Nim language

Awesome Lists containing this project

README

        




Validate HTTP input data in a fancy way.
👑 Written in Nim language


nimble install bag


API reference

Github Actions | Github Actions

## 😍 Key Features
- [x] Macro-based validation
- [x] Framework agnostic
- [x] i18n support
- [x] Based on [Valido package](https://github.com/openpeeps/valido)
- [x] Open Source | `MIT` License
- [x] Written in 👑 Nim language

## Examples

```nim
# can be a seq/array containing a key/value tuple (string, string)
var data = [("email", "[email protected]"), ("password", "123admin")]

# create a new bag
bag data:
email: tEmail or "auth.error.email"
password: tPassword or "auth.error.password":
min: 8 or "auth.error.password.min"
*remember: tCheckbox # `*` prefix makes field optional
do:
for err in inputBag.getErrors:
echo err
```

For more examples, check in [unittests](https://github.com/openpeeps/bag/blob/main/tests/test1.nim)

### ❤ Contributions & Support
- 🐛 Found a bug? [Create a new Issue](https://github.com/openpeeps/bag/issues)
- 👋 Wanna help? [Fork it!](https://github.com/openpeeps/bag/fork)
- 😎 [Get €20 in cloud credits from Hetzner](https://hetzner.cloud/?ref=Hm0mYGM9NxZ4)
- 🥰 [Donate via PayPal address](https://www.paypal.com/donate/?hosted_button_id=RJK3ZTDWPL55C)

### 🎩 License
Bag | MIT license. [Made by Humans from OpenPeeps](https://github.com/openpeeps).

Copyright © 2024 OpenPeeps & Contributors — All rights reserved.