Skip to content

Commit 4d05b5d

Browse files
committed
Only check in lists and dictionaries
The "in" operator also works on strings which can cause problems with this line if the attribute and the object are named the same thing. Signed-off-by: George Sibble <[email protected]>
1 parent 3cbf2ab commit 4d05b5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/resources/python/swagger.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class ApiClient:
159159
instance = objClass()
160160

161161
for attr, attrType in instance.swaggerTypes.iteritems():
162-
if attr in obj:
162+
if attr in obj and type(obj) in [list, dict]:
163163
value = obj[attr]
164164
if attrType in ['str', 'int', 'long', 'float', 'bool']:
165165
attrType = eval(attrType)

0 commit comments

Comments
 (0)