Are the Moustache Lambdas missing from this plugin...
# swagger-gradle-codegen
p
Are the Moustache Lambdas missing from this plugin? Any generator extending DefaultGenerator are supposed to have them, yet they don’t appear to have any effect in the moustache files https://github.com/OpenAPITools/openapi-generator/blob/master/docs/templating.md#mustache-lambdas
g
Nope we don’t use those. Can I ask you why are you asking this? Is that a concern?
p
Sure, I’m branching your version to better suite the needs of our project. In our case we are building a kotlin multiplatform library and so don’t use retrofit or moshi or anything like that. (I realize there’s a less opinionated swagger gradle plugin out there but for whatever reason we decided to use yours as a starting point) So we’re extending the KotlingCoroutineGenerator and customizing the the moustache files to work with our sdk. These lambdas would help generate functions and class names and such inside the moustache files.
g
Yup makes total sense. Actually we wanted to offer a KMP version of the template for our project as well, so if you happen to have something that works for you, please share it upstream 🙏
👍 1
p
for example something like
private val {{#lambda.camelcase}}{{name}}{{httpMethod}}{{classname}}{{/lambda.camelcase}} = {{lambda.titlecase}}{{httpMethod}}{{classname}}(){{labda.titlecase}}
would generate: private val getPetApi = GetPetApi() Since with kotlin you can have classes and interfaces and whatever else all mixed into a certain .kt file, I was planning on using the api moustache file to generate all the code, and in the correct format, that allows it to work with the design of our sdk. Hope that makes sense.
Will do! We’re still learning our way around swagger and your plugin but it’s been a great help so far! Thanks for the prompt replies.
g
Awesome 👍