Description
version: flask-restplus=0.13.0
A code sample to reproduce the issue:
take this example line
flask-restplus/examples/todomvc.py
Line 14 in 1fe65dd
'id': fields.Integer(description='The task unique identifier', example=0),
You will notice, that 0 will be ignored in the swagger documentation. Passing the string "0" as a value works fine. Passing any other number not as a string works fine as well. Empty lists ([]) don't work either.
Why this happens
This line evaluates wrongly, if the passed variable "example" is set to 0.
flask-restplus/flask_restplus/fields.py
Line 123 in 1fe65dd
Swagger documentation is not created correctly, if 0 as an integer or 0.0 as a float example values in the api.model definition are provided.
Screenshot from created swagger documentation:
Debugger screenshot, self.example != example
Update: An empty list as an example "[]" for list fields evaluates wrongly too.
Partly working workaround
Always use a string, double quoted zero ("0" ) as an example value. But this breaks type safety. field example value will have the wrong type (string).
This workaround does not work for empty list examples example=[]