kotlin-server.libraries.javalin5.api.mustache Maven / Gradle / Ivy
package {{apiPackage}}
import io.javalin.http.Context
import io.javalin.http.bodyAsClass
import io.javalin.http.pathParamAsClass
import io.javalin.http.queryParamAsClass
{{#imports}}import {{import}}
{{/imports}}
{{#operations}}
class {{classname}}(private val service: {{classname}}Service) {
{{#operation}}
/**{{#summary}}
* {{.}}{{/summary}}
* {{unescapedNotes}}
{{#allParams}}* @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}*/
fun {{operationId}}(ctx: Context) {
ctx.status(200).json(service.{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}))
}
{{/operation}}
}
{{/operations}}