java-micronaut.common.operationAnnotations.mustache Maven / Gradle / Ivy
/**
{{#summary}}
* {{summary}}
{{/summary}}
{{#notes}}
* {{notes}}
{{/notes}}
{{^summary}}
{{^notes}}
* {{nickname}}
{{/notes}}
{{/summary}}
*
{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}
{{#returnType}}
* @return {{returnType}}
{{/returnType}}
{{#externalDocs}}
* {{description}}
* @see {{summary}} Documentation
{{/externalDocs}}
*/
{{!openapi annotations for info}}
{{#generateSwagger1Annotations}}
@ApiOperation(
value = "{{{summary}}}",
nickname = "{{{operationId}}}"{{#notes}},
notes = "{{{notes}}}"{{/notes}}{{#returnBaseType}},
response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}},
responseContainer = "{{{returnContainer}}}"{{/returnContainer}},
authorizations = {{openbrace}}{{#hasAuthMethods}}
{{#authMethods}}
{{#isOAuth}}
@Authorization(value = "{{name}}"{{#scopes.0}}, scopes = {
{{#scopes}}
@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},{{/-last}}
{{/scopes}}
}{{/scopes.0}}){{^-last}},{{/-last}}
{{/isOAuth}}
{{^isOAuth}}
@Authorization(value = "{{name}}"){{^-last}},{{/-last}}
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}{{closebrace}},
tags = { {{#vendorExtensions.x-tags}}"{{tag}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-tags}} }
)
@ApiResponses(value = {{openbrace}}{{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}.class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}
{{closebrace}})
{{/generateSwagger1Annotations}}
{{#generateSwagger2Annotations}}
@Operation(
operationId = "{{{operationId}}}",
{{#summary}}
summary = "{{{.}}}",
{{/summary}}
{{#description}}
description= "{{{.}}}",
{{/description}}
{{#tags.1}}
{{!generate only when at least 2 tags}}
tags = { {{#tags}}"{{name}}"{{^-last}}, {{/-last}}{{/tags}} },
{{/tags.1}}
responses = {
{{#responses}}
@ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = {
{{#produces}}
@Content(mediaType = "{{{mediaType}}}", schema = @Schema(implementation = {{{baseType}}}.class)){{^-last}},{{/-last}}
{{/produces}}
}{{/baseType}}){{^-last}},{{/-last}}
{{/responses}}
}{{#hasParams}},
parameters = {
{{#allParams}}
@Parameter(name = "{{paramName}}"{{#description}}, description = "{{{description}}}"{{/description}}{{#required}}, required = true{{/required}}){{^-last}},{{/-last}}
{{/allParams}}
}{{/hasParams}}{{#hasAuthMethods}},
security = {
{{#authMethods}}
@SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = { {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} }{{/isOAuth}}){{^-last}},{{/-last}}
{{/authMethods}}
}{{/hasAuthMethods}}
)
{{/generateSwagger2Annotations}}
{{#implicitHeadersParams.0}}
{{#generateSwagger2Annotations}}
@Parameters({
{{#implicitHeadersParams}}
@Parameter(name = "{{paramName}}"{{#description}}, description = "{{{description}}}"{{/description}}{{#required}}, required = true{{/required}}){{^-last}},{{/-last}}
{{/implicitHeadersParams}}
})
{{/generateSwagger2Annotations}}
{{#generateSwagger1Annotations}}
@ApiImplicitParams({
{{#implicitHeadersParams}}
@ApiImplicitParam(name = "{{{baseName}}}", value = "{{{description}}}", {{#required}}required = true,{{/required}} dataType = "{{{dataType}}}", paramType = "header"){{^-last}},{{/-last}}
{{/implicitHeadersParams}}
})
{{/generateSwagger1Annotations}}
{{/implicitHeadersParams.0}}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy