Skip to main content

Simple Serializers for API validations

Project description

# Flask-Simple-Serializer

Simple Serializer to valid API request

### Usage

from flask_simple_serializer.serializers import Serializer
from flask_simple_serializer import StringField, BooleanField, EmailField, validators

class Userserializer(Serializer):
username = StringField('Username')
email = EmailField('Email Address', [validators.Length(min=4, max=25)])
accept_rules = BooleanField('I accept the site rules', [validators.InputRequired()])

def create_user(self):

from flask_simple_serializer.response import Response
from flask_simple_serializer.status_code import HTTP_200_OK, HTTP_400_BAD_REQUEST

from my_app.serializes import Userserializer

def user_registration():
serializer = UserSerializer(request.json)

if serializer.is_valid()
# Do something
return Response(status_code=HTTP_200_OK)
return Response(serializer.errors, status_code=HTTP_400_BAD_REQUEST)

### TODO
- Model Serializer
- Serializer that accept Model instance (SqlAlchemy)
- Improve Documentation
- Custom Felds
- Parse request decorators
- Test for Response and Status Codes

Project details

Download files

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

Files for Flask-Simple-Serializer, version 1.1.3
Filename, size File type Python version Upload date Hashes
Filename, size Flask_Simple_Serializer-1.1.3-py3-none-any.whl (7.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Flask-Simple-Serializer-1.1.3.tar.gz (5.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page