- 
  Notifications
 
You must be signed in to change notification settings  - Fork 6k
 
Added long to primitive data types supported in Python codegen #3146
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
Conversation
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/swagger-api/swagger-codegen/graphs/contributors.
Let me know if you need help fixing it.
Ref: http://stackoverflow.com/questions/3042437/change-commit-author-at-one-specific-commit
Not an issue as long as the checkin makes it through...
Why was this closed? I came across long type problem in python client and this branch will help me. So, it would be great if you could merge this branch to master. Thanks.
Not sure why it's closed by @maneeshsahu
If you've reviewed the change and it looks good, I don't mind reopening the PR and merge later.
(there's an NPM issue impacting CI tests at the moment: npm/npm#13284)
This PR looks good to me. Actually I applied this modification as custom template, I did not find any problem so far.
@taxpon Looks like the change didn't work with Python3:
======================================================================
ERROR: test_get_inventory (tests.test_store_api.StoreApiTests)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/python/tests/test_store_api.py", line 28, in test_get_inventory
 data = self.store_api.get_inventory()
 File "/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/python/petstore_api/apis/store_api.py", line 183, in get_inventory
 (data) = self.get_inventory_with_http_info(**kwargs)
 File "/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/python/petstore_api/apis/store_api.py", line 255, in get_inventory_with_http_info
 _return_http_data_only=params.get('_return_http_data_only'))
 File "/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/python/petstore_api/api_client.py", line 326, in call_api
 response_type, auth_settings, callback, _return_http_data_only)
 File "/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/python/petstore_api/api_client.py", line 114, in __call_api
 header_params = self.sanitize_for_serialization(header_params)
 File "/Users/williamcheng/Code/swagger-api/swagger-codegen/samples/client/petstore/python/petstore_api/api_client.py", line 196, in sanitize_for_serialization
 types = (str, int, long, float, bool, tuple)
NameError: name 'long' is not defined
Maybe we can do an alias, e.g. https://github.com/ansible/ansible/pull/15952/files
Fixed long issue in Python3 via 89befeb.
Test cases are good now:
Ran 79 tests in 60.377s
OK (SKIP=1)
____________________________________________________________ summary _____________________________________________________________
 py27: commands succeeded
 py34: commands succeeded
 congratulations :)
@taxpon please kindly review the fix to see if it looks good from your perspective.
@wing328 looks fine :)
Added long to primitives along with int, float, str, date and tuple. Needed for Python 2.x