Skip to main content

An object serializer inspired by the django forms.

Project description

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for aserializer-0.6.6.tar.gz
Algorithm Hash digest
SHA256 f534332c8e87071a2c9ef229529fe4203679a61d1dcea545fc4cd1ca3216cf36
MD5 c61770c54df01e7bd6dd908e8e3912a2
BLAKE2b-256 080100e61cb6edfa3effd44178c153079fa9362031a59db2e7767a77192976fc

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