forked from loafle/openapi-generator-original
The linting results for the generated samples are as follows where the first number is the BEFORE and the second is AFTER. flaskConnexion 1843 vs. 20 flaskConnexion-python2 1841 vs. 19 For the complete details please see the following gist. https://gist.github.com/kenjones-cisco/edc9d71ef7fd2bf23714ecbb693d52b3
21 lines
608 B
Python
21 lines
608 B
Python
from connexion.apps.flask_app import FlaskJSONEncoder
|
|
import six
|
|
|
|
from swagger_server.models.base_model_ import Model
|
|
|
|
|
|
class JSONEncoder(FlaskJSONEncoder):
|
|
include_nulls = False
|
|
|
|
def default(self, o):
|
|
if isinstance(o, Model):
|
|
dikt = {}
|
|
for attr, _ in six.iteritems(o.swagger_types):
|
|
value = getattr(o, attr)
|
|
if value is None and not self.include_nulls:
|
|
continue
|
|
attr = o.attribute_map[attr]
|
|
dikt[attr] = value
|
|
return dikt
|
|
return FlaskJSONEncoder.default(self, o)
|