Yelp/swagger-py — pull request #11 by prat0318 (2014-07-03 00:11:01+00:00)
Title: Allow Python model as request body parameter.

* Accept Py model in request body.

Swagger-py lets you build any instance of a model without any check.
But, when it is passed as a request body param, validation checks kick
in. `_flat_dict()` is used to recursively convert the model into a dict
which json can dump later.

While this conversion, type is checked against the swagger spec.
If any of the attrs are None (that happens if a default instance is
created and any of the attrs are complex) they are removed from the
dict. And if they were required for that model, Error is raised.

---

* If the response if of type None, just accept anything and do not validate.

As per: wordnik's swagger spec, operation type for pet.addPet is void
but still the response sent back is `{u'code': 200, u'message':
u'SUCCESS'}`, which has no concrete structure to check against.

Tests:
```
py26 inst-nodeps: /nail/home/prateek/pg/swagger-py/.tox/dist/swaggerpy-0.3.0.zip
py26 runtests: commands[0] | nosetests
/nail/home/prateek/pg/swagger-py/.tox/py26/lib/python2.6/site-packages/twisted/internet/endpoints.py:30: DeprecationWarning: twisted.internet.interfaces.IStreamClientEndpointStringParser was deprecated in Twisted 14.0.0: This interface has been superseded by IStreamClientEndpointStringParserWithReactor.
from twisted.internet.interfaces import (
............................................................................................
----------------------------------------------------------------------
Ran 92 tests in 0.852s

OK
py27 inst-nodeps: /nail/home/prateek/pg/swagger-py/.tox/dist/swaggerpy-0.3.0.zip
py27 runtests: commands[0] | nosetests
............................................................................................
----------------------------------------------------------------------
Ran 92 tests in 0.684s

OK
flake8 inst-nodeps: /nail/home/prateek/pg/swagger-py/.tox/dist/swaggerpy-0.3.0.zip
flake8 runtests: commands[0] | flake8 swaggerpy
flake8 runtests: commands[1] | flake8 swaggerpy_test
_______________________________________________________________ summary _______________________________________________________________
py26: commands succeeded
py27: commands succeeded
flake8: commands succeeded
congratulations :)
```