Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response breaks if it contains a field of datetime #17

Closed
prat0318 opened this issue Jul 11, 2014 · 1 comment
Closed

Response breaks if it contains a field of datetime #17

prat0318 opened this issue Jul 11, 2014 · 1 comment
Labels

Comments

@prat0318
Copy link
Contributor

swagger-py tries to create default instance of datetime, but datetime doesn't have a zero args constructor.

n [9]: client.store.getOrderById(orderId="1").result()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-6265fd495d50> in <module>()
----> 1 client.store.getOrderById(orderId="1").result()

/nail/home/prateek/pg/mypy2/lib/python2.6/site-packages/swaggerpy/response.pyc in result(self, timeout)
     50         response = self._http_client.wait(timeout)
     51         response.raise_for_status()
---> 52         return self._postHTTP_callback(response)
     53
     54

/nail/home/prateek/pg/mypy2/lib/python2.6/site-packages/swaggerpy/client.pyc in py_model_convert_callback(response)
    132                 # Validate and convert API response to Python model instance
    133                 value = SwaggerResponse(
--> 134                     response.json(), type_, self._models).swagger_object
    135             return value
    136         return HTTPFuture(self._http_client,

/nail/home/prateek/pg/mypy2/lib/python2.6/site-packages/swaggerpy/response.pyc in __init__(self, response, type_, models)
     94         self.swagger_object = SwaggerResponseConstruct(response,
     95                                                        type_,
---> 96                                                        models).create_object()
     97
     98

/nail/home/prateek/pg/mypy2/lib/python2.6/site-packages/swaggerpy/response.pyc in create_object(self)
    126         if swagger_type.is_array(self._type):
    127             return self._create_array_object()
--> 128         return self._create_complex_object()
    129
    130     def _create_array_object(self):

/nail/home/prateek/pg/mypy2/lib/python2.6/site-packages/swaggerpy/response.pyc in _create_complex_object(self)
    144         """
    145         klass = getattr(self._models, self._type)
--> 146         instance = klass()
    147         for key in self._response.keys():
    148             type_ = klass._swagger_types[key]

/nail/home/prateek/pg/mypy2/lib/python2.6/site-packages/swaggerpy/swagger_model.pyc in <lambda>(self, **kwargs)
    296         __eq__=lambda self, other: compare(self, other),
    297         # Define the constructor for the type
--> 298         __init__=lambda self, **kwargs: set_props(self, **kwargs),
    299         # Define the str repr of the type
    300         __repr__=lambda self: create_model_repr(self))

/nail/home/prateek/pg/mypy2/lib/python2.6/site-packages/swaggerpy/swagger_model.pyc in set_props(model, **kwargs)
    322         swagger_py_type = swagger_type.swagger_to_py_type(
    323             property_swagger_type)
--> 324         property_value = swagger_py_type() if swagger_py_type else None
    325         # Override any property values specified in kwargs
    326         if property_name in arg_keys:

TypeError: Required argument 'year' (pos 1) not found
prat0318 added a commit that referenced this issue Jul 11, 2014
@prat0318 prat0318 added the bug label Jul 11, 2014
@prat0318
Copy link
Contributor Author

Fixed in #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant