Skip to main content

A simple schema builder for value parsing and validation

Project description

PyYep

PyYep is a python schema builder for value parsing and validation. Define a schema, transform a value to match and validate the inputs with existing validator or custom functions.

PyYep is heavily inspired by Yup

Docs

Install

pip install PyYep

Usage

You define and create schema objects with its inputs and validation methods. Then use the verify method to check the schema. A ValidationError will be raised if some input value does not match the validation.

from PyYep import Schema, InputItem, ValidationError

schema = Schema([
	InputItem('name', input_object, 'path-to-input_object-value-property-or-method').string().email(),
	InputItem('name', input_object, 'path-to-input_object-value-property-or-method').number().min(10).max(100),
], abort_early=False) 

// check validity

try:
	result = schema.validate()
	# handle result
except ValidationError:
	# handle fail

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyYep-1.1.0.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

PyYep-1.1.0-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page