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.0.tar.gz (18.1 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for aserializer-0.8.0.tar.gz
Algorithm Hash digest
SHA256 85a48a989fa0ec6ea101654c16eec3938f935d9d09b45d329346b1e1d319d134
MD5 0df234d016c826078d5f27d449931dda
BLAKE2b-256 55cebabb07fc817b21ec77619873f7462a57d131e7a530acedf17a13f62014df

See more details on using hashes here.

Supported by

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