fixed bug in camel case transformer

This commit is contained in:
Matthias Bisping 2022-03-31 15:55:15 +02:00
parent 2a62ad7aba
commit 2517b45d44

View File

@ -19,7 +19,8 @@ class Snake2CamelCaseKeyFormatter(Formatter):
# If we wanted to do this properly, we would need handlers for all expected types and dispatch based
# on a type comparison. This is too much engineering for the limited use-case of this class though.
if isinstance(data, Iterable) and not isinstance(data, dict) and not isinstance(data, str):
return type(data)(map(self.__format, data))
f = map(self.__format, data)
return type(data)(f) if not isinstance(data, map) else f
if not isinstance(data, dict):
return data