Skip to main content

An object serializer inspired by the django forms.

Project description

https://travis-ci.org/onyg/aserializer.png?branch=master https://img.shields.io/coveralls/onyg/aserializer/master.svg pypi

About

aserializer is an object serializer inspired by the django forms.

Examples

Examples how code looks like:

class Address(Serializer):
    id = IntegerField(required=True, identity=True)
    street = StringField(required=True)
    streetNumber = StringField(required=True)
    city = StringField(required=False)
    country = StringField(required=False)

class User(Serializer):
    _type = TypeField('user')
    id = IntegerField(required=True, identity=True)
    name = StringField(required=True)
    email = EmailField(required=True)
    tel = StringField(required=False, min_length=10, max_length=50)
    address = SerializerField(Address, required=True)

Result:

user = User(DATA)
user.dump()

{
  "_type": "user",
  "id": 1,
  "name": "Joe",
  "email": "joe@example.com",
  "tel": "+49 555 555 12",
  "address": {
    "id": 1,
    "street": "Street",
    "streetNumber": "5a",
    "city": "Berlin",
    "country": "Germany"
  }
}

Tests

To run the tests use the command: python setup.py nosetests

Contributing

Please find bugs and send pull requests to the GitHub repository and issue tracker.

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

aserializer-0.8.1.tar.gz (18.3 kB view details)

Uploaded Source

File details

Details for the file aserializer-0.8.1.tar.gz.

File metadata

  • Download URL: aserializer-0.8.1.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aserializer-0.8.1.tar.gz
Algorithm Hash digest
SHA256 a6ca2aa83318523de9414d8f3d720bef68847277cf5fa8ed8ce423dfbe78c9cb
MD5 41483244e6d6d6529944d0e13a680ed8
BLAKE2b-256 d4596333bf85b3459c919e1c2660b06642110a0bf405fb386efbe7fcb4a0eb4d

See more details on using hashes here.

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