wordnik/swagger-core — pull request #429 by bkowalik (2014-01-16 10:18:54+00:00)
Title: Put fields in order that were declared in class

It's quite annoying when you have to specialize fields order in bean classes. Mostly they are declared in order that we want to have in API. I know that I'm using getDeclaredFields method that does not guarantee order due to documentation but I've found that this note is legacy.

The origin of my pull request is that I wanted to have my case class' fields in API in the same order that were declared. Because case class is mostly generated by in compilation process methods that are used to get access to fields are totally random order. I understand that swagger gets only public methods and fields so I wrote code that gets private fields and returns collection which contains presorted properties by order of those private fields. When you declare your own ordering using position parameter you will get new order of fields. So this modification does not break old APIs.