Skip to content

openpeeps/bag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


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

nimble install bag

API reference
Github Actions | Github Actions

😍 Key Features

  • Macro-based webform validation
  • Framework agnostic
  • i18n support
  • Based on Valido package
  • Open Source | MIT License
  • Written in 👑 Nim language

Examples

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.

❤ Contributions & Support

🎩 License

Bag | MIT license. Made by Humans from OpenPeeps.
Copyright © OpenPeeps & Contributors — All rights reserved.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Generated from openpeeps/pistachio