Swagger-codegen: [Python] Better JSON Serialization and Marshaling

Created on 19 Apr 2017  路  3Comments  路  Source: swagger-api/swagger-codegen

Description

Currently, the Python API client relies on our own deserialiser to convert JSON string back into Python objects with support of attribute mapping. For other generators (e.g. Java, C#), we're leveraging 3rd-party libraries/modules to handle serialization/deserialization between objects and JSON strings

We would like to evaluate different Python modules to perform similar tasks instead of maintaining our own serialization/deserialisation logic:

If anyone has comments/suggestions or want to contribute to this enhancement, please reply to let us know. Thank you.

Python Feature help wanted

Most helpful comment

Marshmallow is a mature and well-maintained project for serializing/deserializing, encoding, and validation. Marshmallow has quite rich ecosystem providing a number of extensions: Marshmallow-SQLAlchemy, Webargs, Apispec, Flask-Marshmallow, Flask-Apispec, ...

I have no experience with Kim, so I cannot compare it to Marshmallow, but Marshmallow has never failed me.

All 3 comments

Kim is just one of the Python module for serialization/deserialization. If anyone has recommendations for other Python modules to perform similar tasks, please let us know.

Marshmallow is a mature and well-maintained project for serializing/deserializing, encoding, and validation. Marshmallow has quite rich ecosystem providing a number of extensions: Marshmallow-SQLAlchemy, Webargs, Apispec, Flask-Marshmallow, Flask-Apispec, ...

I have no experience with Kim, so I cannot compare it to Marshmallow, but Marshmallow has never failed me.

There is a benchmark of various Python serializers: https://voidfiles.github.io/python-serialization-benchmark/

Given the results of the benchmark, lima looks like a clear winner, and there are at least 3 more alternatives: serpy, Strainer, Lollipop.

Was this page helpful?
0 / 5 - 0 ratings