microsoft / thrifty

Thrift for Android that saves you methods
Apache License 2.0
544 stars 102 forks source link

Gradle plugin ignores FieldNameStyle specification for Kotlin code gen #537

Closed rhappe closed 1 year ago

rhappe commented 1 year ago

Hi Thrifty devs!

I was trying to implement thrifty in my android project using the Gradle plugin so that we can benefit from the language features of Kotlin (null-safety etc).

I'm currently using regular apache-thrift to generate java thrifts, and we specify that our field names should be generated using camelCase. So to make migration to Thrifty easier I'm trying to use the nameStyle field. However this doesn't appear to be working as expected as I'm still seeing the fields using the DEFAULT styling (as-is in thrift source).

I did some digging and it looks like perhaps the plugin is not passing the nameStyle input to the KotlinCodeGenerator, so it just defaults to the DEFAULT style.

thrifty {
    kotlin {
        nameStyle 'java'
    }
}
benjamin-bader commented 1 year ago

Great catch, and simple fix - thanks for both!