Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/closeio/cleancat
Validation and serialization library for Python designed to be used with JSON REST frameworks
https://github.com/closeio/cleancat
Last synced: about 1 month ago
JSON representation
Validation and serialization library for Python designed to be used with JSON REST frameworks
- Host: GitHub
- URL: https://github.com/closeio/cleancat
- Owner: closeio
- License: mit
- Created: 2012-09-27T03:03:19.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T17:48:26.000Z (9 months ago)
- Last Synced: 2024-08-09T15:21:19.775Z (5 months ago)
- Language: Python
- Homepage:
- Size: 346 KB
- Stars: 51
- Watchers: 20
- Forks: 7
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
CleanCat
========[![Build Status](https://travis-ci.org/closeio/cleancat.svg?branch=master)](https://travis-ci.org/closeio/cleancat)
Validation library for Python designed to be used with JSON REST frameworks
### Basic example in Flask
```py
class JobApplication(Schema):
first_name = String()
last_name = String()
email = Email()
urls = List(URL(default_scheme='http://'))@app.route('/job_application', methods=['POST'])
def test_view():
schema = JobApplication(request.json)
try:
data = schema.full_clean()
except SchemaValidationError:
return jsonify({'field-errors': schema.field_errors, 'errors': schema.errors }), 400
# Now "data" has the validated data
```