All Downloads are FREE. Search and download functionalities are using the official Maven repository.

openapi.templates.kora.kotlinServerApi.mustache Maven / Gradle / Ivy

There is a newer version: 1.1.16
Show newest version
/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
package {{package}}

import ru.tinkoff.kora.http.server.common.HttpServerInterceptor;
import jakarta.annotation.Nullable;

{{#imports}}import {{import}}
{{/imports}}
{{#requestInDelegateParams}}
import ru.tinkoff.kora.http.server.common.HttpServerRequest
{{/requestInDelegateParams}}

@ru.tinkoff.kora.common.annotation.Generated("openapi generator kora server"){{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
@ru.tinkoff.kora.http.server.common.annotation.HttpController{{#vendorExtensions.enableValidation}}
@ru.tinkoff.kora.common.Component{{/vendorExtensions.enableValidation}}
{{#vendorExtensions.enableValidation}}open {{/vendorExtensions.enableValidation}}class {{classname}}Controller(private val delegate: {{classname}}Delegate) {
{{#operations}}
{{#operation}}
    /**
     * {{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}}
    {{#notes}}
     * {{.}}
    {{/notes}}
     *
    {{#allParams}}
     * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}
    {{/allParams}}
     * @return {{#responses}}{{message}} (status code {{code}}){{^-last}}
     *         or {{/-last}}{{/responses}}
    {{#isDeprecated}}
     * @deprecated
    {{/isDeprecated}}
    {{#externalDocs}}
     * {{description}}
     * @see {{summary}} Documentation
    {{/externalDocs}}
     */
    @ru.tinkoff.kora.http.common.annotation.HttpRoute(method = "{{httpMethod}}", path = "{{path}}"){{#implicitHeaders}}
    @ApiImplicitParams({
    {{#headerParams}}
     TODO implicit header
    {{>implicitHeader}}
    {{/headerParams}}
    })
    {{/implicitHeaders}}{{#hasAuthMethods}}
    @ru.tinkoff.kora.http.common.annotation.InterceptWith(tag = ru.tinkoff.kora.common.Tag(ApiSecurity.{{vendorExtensions.authInterceptorTag}}::class), value = HttpServerInterceptor::class){{/hasAuthMethods}}{{#vendorExtensions.x-validate}}
    @ru.tinkoff.kora.http.common.annotation.InterceptWith(ru.tinkoff.kora.validation.module.http.server.ValidationHttpServerInterceptor::class)
    @ru.tinkoff.kora.validation.common.annotation.Validate
    {{/vendorExtensions.x-validate}}
    {{#koraInterceptors}}
    {{#interceptorTags}}
    @ru.tinkoff.kora.http.common.annotation.InterceptWith(tag = ru.tinkoff.kora.common.Tag(value = [{{interceptorTags}}]), value = {{interceptorImpl}})
    {{/interceptorTags}}
    {{^interceptorTags}}
    @ru.tinkoff.kora.http.common.annotation.InterceptWith({{interceptorImpl}})
    {{/interceptorTags}}
    {{/koraInterceptors}}
    @ru.tinkoff.kora.common.Mapping({{classname}}ServerResponseMappers.{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}ResponseMapper::class)
    {{#vendorExtensions.enableValidation}}open {{/vendorExtensions.enableValidation}}{{#isSuspend}}suspend {{/isSuspend}}fun {{operationId}}({{#vendorExtensions.requestInDelegateParams}}_serverRequest: HttpServerRequest{{#hasParams}}, {{/hasParams}}{{/vendorExtensions.requestInDelegateParams}}{{>kotlinAnnotatedParams}}): {{classname}}Responses.{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}ApiResponse {
      return this.delegate.{{operationId}}({{#vendorExtensions.requestInDelegateParams}}_serverRequest{{#hasParams}}, {{/hasParams}}{{/vendorExtensions.requestInDelegateParams}}
        {{#allParams}}{{#lambda.trim}}
        {{#hasFormParams}}{{^isFormParam}}{{paramName}},{{/isFormParam}}{{/hasFormParams}}
        {{^hasFormParams}}{{paramName}}{{^-last}},{{/-last}}{{/hasFormParams}}{{/lambda.trim}}{{/allParams}}{{#hasFormParams}}
        form{{/hasFormParams}}
      )
    }

{{#hasFormParams}}
    @ru.tinkoff.kora.common.annotation.Generated("openapi generator kora client")
    data class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}FormParam(
      {{#formParams}}
          val {{paramName}}: {{#isFile}}ru.tinkoff.kora.http.common.form.FormMultipart.FormPart.MultipartFile{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}}{{^required}}?{{/required}}{{^-last}},{{/-last}}
      {{/formParams}}
    ){}
{{/hasFormParams}}


{{/operation}}
}
{{/operations}}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy