ntrrgc / ts-generator

Generate TypeScript definitions from Kotlin/Java/JVM classes
Other
262 stars 45 forks source link

Field ordering #41

Open kennycason opened 2 years ago

kennycason commented 2 years ago

I noticed #13 was closed, but I'm also interested in being able to preserve sort order. I've integrated the library and have really enjoyed it, but being able to preserve field order is important enough that I fear it will ultimately result in us not being able to use the library without this feature as we are currently still manually sorting fields by hand post generation.

I see that the field ordering is based on Kotlin's reflection library, but am curious if you have any ideas on how to implement this feature?

I also noticed the ClassTransfomer.transformPropertyList(properties: List<KProperty<*>>, klass: KClass<*>): List<KProperty<*>> which looked promising but I haven't dug in very deeply.

Thanks!