Closed ArjixWasTaken closed 1 year ago
maybe add a naming template in the plugin params? that way we can have whatever naming scheme we want
Hi there, thanks for the suggestion! Unfortunately, this feature would require a lot of rework. I use this generator for a lot of projects and am actually quite happy with the current state. But you are right, the auto-generated names are not really nice to read or use.
Can't you just use the operationId
property for each operation in your spec? That's what we use in all our specs.
For example:
/my_endpoint_name_sucks:
get:
operationId: hello
...
Would generate MyApi.hello()
That is exactly what I needed! Thank you so much!!
I am not really that knowledgeable about OpenAPI, it is auto generated by swagger for me, so I didn't know that was an option. This issue has been resolved.
Commenting here instead of opening a new issue since this ain't an issue
On another note, the spacing of the generated code is odd
Yeah, that's because of the library I use for the Kotlin code generation: Kotlin Poet.
You could run a code formatter on the generated code, if you care enough. Something like: Ktlint
My API methods are already fluently named, so the generated names suck.
Original API
Generated client:
AuthApi.postApiAuthLogin
,AuthApi.postApiAuthLogout
,AuthApi.postApiAuthRefresh
would be nicer is they were just named
AuthApi.Login
,AuthApi.Logout
,AuthApi.Refresh