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

templates.java-micronaut.server.controller-interface.mustache Maven / Gradle / Ivy

{{>common/licenseInfo}}
package {{apiPackage}};
{{#formatNoEmptyLines}}
import io.micronaut.http.annotation.*;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.core.convert.format.Format;
{{#useAuth}}
import io.micronaut.security.annotation.Secured;
import io.micronaut.security.rules.SecurityRule;
{{/useAuth}}
{{#wrapInHttpResponse}}
import io.micronaut.http.HttpResponse;
{{/wrapInHttpResponse}}
{{#imports}}
import {{import}};
{{/imports}}
{{#generatedAnnotation}}
import {{javaxPackage}}.annotation.Generated;
{{/generatedAnnotation}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.Valid;
import {{javaxPackage}}.validation.constraints.*;
{{/useBeanValidation}}
{{#generateSwagger2Annotations}}
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
{{/generateSwagger2Annotations}}
{{/formatNoEmptyLines}}

{{#formatOneEmptyLine}}
{{#generatedAnnotation}}
{{>common/generatedAnnotation}}
{{/generatedAnnotation}}
{{^generateControllerAsAbstract}}
@Controller
{{/generateControllerAsAbstract}}
{{#generateSwagger2Annotations}}
@Tag(name = "{{{baseName}}}", description = {{#tagDescription}}"{{{.}}}"{{/tagDescription}}{{^tagDescription}}"The {{{baseName}}} API"{{/tagDescription}})
{{/generateSwagger2Annotations}}
public interface {{classname}} {

{{#operations}}
    {{#operation}}
        {{#formatNoEmptyLines}}
{{>common/operationAnnotations}}
    @{{#lambda.pascalcase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.pascalcase}}("{{{path}}}")
    {{^vendorExtensions.onlyDefaultProduceOrEmpty}}
    @Produces({{#produces.1}}{{openbrace}}{{/produces.1}}{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}{{#produces.1}}{{closebrace}}{{/produces.1}})
    {{/vendorExtensions.onlyDefaultProduceOrEmpty}}
    {{^vendorExtensions.onlyDefaultConsumeOrEmpty}}
    @Consumes({{#consumes.1}}{{openbrace}}{{/consumes.1}}{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}{{#consumes.1}}{{closebrace}}{{/consumes.1}})
    {{/vendorExtensions.onlyDefaultConsumeOrEmpty}}
    {{!security annotations}}
    {{#useAuth}}
    @Secured({{#vendorExtensions.x-roles.1}}{{openbrace}}{{/vendorExtensions.x-roles.1}}{{#vendorExtensions.x-roles}}{{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-roles}}{{#vendorExtensions.x-roles.1}}{{closebrace}}{{/vendorExtensions.x-roles.1}})
    {{/useAuth}}
    {{!the method definition}}
    {{#vendorExtensions.x-operation-extra-annotation}}
    {{{.}}}
    {{/vendorExtensions.x-operation-extra-annotation}}
    {{^returnType}}void{{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}} {{nickname}}({{#allParams}}
        {{#formatSingleLine}}{{>server/params/annotations}}{{#indent}}{{>common/params/validation}}{{/indent}}{{>server/params/type}} {{paramName}}{{^-last}},{{/-last}}{{/formatSingleLine}}
    {{/allParams}});
        {{/formatNoEmptyLines}}

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy