JavaServer.api.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codegen Show documentation
Show all versions of codegen Show documentation
This artefact generates other artefacts such as API client, API server out of API Model
/**
* 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}};
{{#imports}}import {{import}};
{{/imports}}
import io.swagger.annotations.*;
{{#jdk8-no-delegate}}
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
{{/jdk8-no-delegate}}
import org.springframework.http.ResponseEntity;
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated;
{{/useBeanValidation}}
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;
{{#useBeanValidation}}
import javax.validation.Valid;
import javax.validation.constraints.*;
{{/useBeanValidation}}
import java.util.List;
import java.util.Map;
import java.util.Optional;
{{#useBeanValidation}}
@Validated
{{/useBeanValidation}}
@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API")
{{#operations}}
public interface {{classname}} {
default Optional getRequest() {
return Optional.empty();
}
{{#operation}}
{{#virtualService}}
@ApiVirtual
{{/virtualService}}
@ApiOperation(
value = "{{{summary}}}",
nickname = "{{{operationId}}}",
notes = "{{{notes}}}"{{#returnBaseType}},
response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}},
responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}},
authorizations = {
{{#authMethods}}@Authorization(
value = "{{name}}"{{#isOAuth}},
scopes = {
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
{{/hasMore}}{{/scopes}}
}{{/isOAuth}}){{#hasMore}},
{{/hasMore}}{{/authMethods}}
}{{/hasAuthMethods}},
tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }
)
@ApiResponses(value = { {{#responses}}
@ApiResponse(
code = {{{code}}},
message = "{{{message}}}"{{#baseType}},
response = {{{baseType}}}.class{{/baseType}}{{#containerType}},
responseContainer = "{{{containerType}}}"{{/containerType}}
){{#hasMore}},{{/hasMore}}{{/responses}}
})
{{#implicitHeaders}}
@ApiImplicitParams({
{{#headerParams}}
{{>implicitHeader}}
{{/headerParams}}
})
{{/implicitHeaders}}
@RequestMapping(
value = "{{{path}}}",
method = RequestMethod.{{httpMethod}}
)
{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}
{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}
);
{{/operation}}
}
{{/operations}}