As described on StackOverflow there is an issue serializing array with RestTemplate. The work around was suggested, but I can't use it in my current project because code with rest template is generated by swagger.
The pull request is attached.
I am not sure about the performance of this fix since I am new to Java. But I will appreciate any help and comments so I can improve this solution to make it production ready.
Artem Loginov can you please update the description of the issue to be self-sufficient, independent of StackOverflow? In particular please provide the concrete example that you have in mind.
My concern with this is that URI variable value expansion was never meant to be a type conversion mechanism. Besides collections, there are arrays, maps, they can be nested, and so one, one can go on endlessly. While in your case evidently you don't want brackets, in other cases others might want them, and they could be relying on it today, and there would be no way to customize this. If we're going to go down that route I would rather see a ConversionService being used, e.g. in the RestTemplate.
@Rossen Stoyanchev, Thank you for your comment. I completely agree with it. I have not thought about corner cases. But it is still not obvious that spring uses toString for some cases. I will agree on primitives, but not on collections. In any case I think this is not a bug, but just specific implementation case. So will close the issue. Feel free to write me an email or contact in any other way if you need more information.