swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Python client code fail due to ImportError

Open madhuri-rai07 opened this issue 11 years ago • 5 comments

The module name and the class name differs in Python code which make it fail due to ImportError.

madhuri-rai07 avatar Apr 06 '15 00:04 madhuri-rai07

Fixed in https://github.com/swagger-api/swagger-codegen/pull/609

geekerzp avatar Apr 09 '15 02:04 geekerzp

Hi, I am still facing the issue in python generated client code. Here, https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/python/api.mustache#L106

Example spec sample: { "type": "test_type", "method": "POST", "summary": "test_summary", "nickname": "test_nickname", "parameters": [ { "type": "string", "paramType": "path", "name": "name", "description": "test decription", "required": true, "allowMultiple": false }, { "type": "test_type", "paramType": "body", "name": "body", "description": "", "required": true, "allowMultiple": false }

From the above spec, the returnType will be "test_type" but the model files created by swagger-codegen has name "Test_type.py" and model class named as "Test_type" so it failed to import so while deserializing.

madhuri-rai07 avatar Apr 16 '15 01:04 madhuri-rai07

I did a test locally with petstore by renaming Tag to tag_test. The model filename is correctly set to tag_test.py and the class name is also correct: class TagTest(object):

Were you testing with develop_2.0 branch?

wing328 avatar Apr 16 '15 02:04 wing328

I used the master.

madhuri-rai07 avatar Apr 16 '15 03:04 madhuri-rai07

Please test with develop_2.0 branch to see if the issue persists

wing328 avatar Apr 16 '15 03:04 wing328