All Projects → guyskk → Validr

guyskk / Validr

Licence: other
A simple, fast, extensible python library for data validation.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Validr

Swagger Cli
Swagger 2.0 and OpenAPI 3.0 command-line tool
Stars: ✭ 321 (+56.59%)
Mutual labels:  json-schema, validation, validator
openui5-validator
A library to validate OpenUI5 fields
Stars: ✭ 17 (-91.71%)
Mutual labels:  validation, json-schema, validator
Swagger Parser
Swagger 2.0 and OpenAPI 3.0 parser/validator
Stars: ✭ 710 (+246.34%)
Mutual labels:  json-schema, validation, validator
Maat
Validation and transformation library powered by deductive ascending parser. Made to be extended for any kind of project.
Stars: ✭ 27 (-86.83%)
Mutual labels:  validation, json-schema, validator
Schemasafe
A reasonably safe JSON Schema validator with draft-04/06/07/2019-09 support.
Stars: ✭ 67 (-67.32%)
Mutual labels:  json-schema, validation, validator
Credit Card
Credit Card Validation
Stars: ✭ 150 (-26.83%)
Mutual labels:  validation, validator
Class Transformer Validator
A simple plugin for class-transformer and class-validator which combines them in a nice and programmer-friendly API.
Stars: ✭ 151 (-26.34%)
Mutual labels:  validation, validator
Ajv Keywords
Custom JSON-Schema keywords for Ajv validator
Stars: ✭ 186 (-9.27%)
Mutual labels:  json-schema, validator
Schema Utils
Options Validation
Stars: ✭ 162 (-20.98%)
Mutual labels:  validation, validator
Validation
🔒 Laravel farsi/persian validation
Stars: ✭ 142 (-30.73%)
Mutual labels:  validation, validator
Formhelper
ASP.NET Core - Transform server-side validations to client-side without writing any javascript code. (Compatible with Fluent Validation)
Stars: ✭ 155 (-24.39%)
Mutual labels:  validation, validator
Validot
Validot is a performance-first, compact library for advanced model validation. Using a simple declarative fluent interface, it efficiently handles classes, structs, nested members, collections, nullables, plus any relation or combination of them. It also supports translations, custom logic extensions with tests, and DI containers.
Stars: ✭ 198 (-3.41%)
Mutual labels:  validation, validator
Validation
The power of Respect Validation on Laravel
Stars: ✭ 188 (-8.29%)
Mutual labels:  validation, validator
Ajv Cli
Use 'Another Json Validator' (ajv) from the command line
Stars: ✭ 148 (-27.8%)
Mutual labels:  json-schema, validator
Property Validator
✅ Easy property validation for JavaScript, Node and Express.
Stars: ✭ 153 (-25.37%)
Mutual labels:  validation, validator
Aptos
☀️ A tool for validating data using JSON Schema and converting JSON Schema documents into different data-interchange formats
Stars: ✭ 144 (-29.76%)
Mutual labels:  json-schema, validation
Validation Composite
Allows uniting of several validation rules into single one for easy re-usage
Stars: ✭ 159 (-22.44%)
Mutual labels:  validation, validator
Joiful
TypeScript Declarative Validation for Joi
Stars: ✭ 177 (-13.66%)
Mutual labels:  validation, validator
Ozzo Validation
An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.
Stars: ✭ 2,471 (+1105.37%)
Mutual labels:  validation, validator
Validator
The Validator component provides tools to validate values following the JSR-303 Bean Validation specification.
Stars: ✭ 2,238 (+991.71%)
Mutual labels:  validation, validator

Validr

travis-ci codecov

A simple, fast, extensible python library for data validation.

  • Simple and readable schema
  • 10X faster than jsonschema, 40X faster than schematics
  • Can validate and serialize any object
  • Easy to create custom validators
  • Accurate and friendly error messages

简单,快速,可拓展的数据校验库。

  • 简洁,易读的 Schema
  • jsonschema 快 10 倍,比 schematics 快 40 倍
  • 能够校验&序列化任意类型对象
  • 易于拓展自定义校验器
  • 准确友好的错误提示

Overview

from validr import T, modelclass, asdict

@modelclass
class Model:
    """Base Model"""

class Person(Model):
    name=T.str.maxlen(16).desc('at most 16 chars')
    website=T.url.optional.desc('website is optional')

guyskk = Person(name='guyskk', website='https://github.com/guyskk')
print(asdict(guyskk))

Install

Note: Only support Python 3.5+

pip install validr

When you have c compiler in your system, validr will be c speedup mode. Otherwise validr will fallback to pure python mode.

To force c speedup mode:

VALIDR_SETUP_MODE=c pip install validr

To force pure python mode:

VALIDR_SETUP_MODE=py pip install validr

Document

https://github.com/guyskk/validr/wiki

Performance

benchmark result in Travis-CI:

--------------------------timeits---------------------------
  voluptuous:default             10000 loops cost 0.368s
      schema:default              1000 loops cost 0.318s
        json:loads-dumps        100000 loops cost 1.380s
      validr:default            100000 loops cost 0.719s
      validr:model              100000 loops cost 1.676s
  jsonschema:draft3              10000 loops cost 0.822s
  jsonschema:draft4              10000 loops cost 0.785s
  schematics:default              1000 loops cost 0.792s
---------------------------scores---------------------------
  voluptuous:default               375
      schema:default                43
        json:loads-dumps          1000
      validr:default              1918
      validr:model                 823
  jsonschema:draft3                168
  jsonschema:draft4                176
  schematics:default                17

Develop

Validr is implemented by Cython since v0.14.0, it's 5X faster than pure Python implemented.

setup:

It's better to use virtualenv or similar tools to create isolated Python environment for develop.

After that, install dependencys:

./bootstrap.sh

build, test and benchmark:

inv build
inv test
inv benchmark

License

Anti-996 License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].