mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-23 01:00:52 +00:00
* update generated sample for spring boot #4091 * add beanvalidation annotations to spring #4091 * add tests for spring #4091 * cleanup spring-cloud (client lib) #4091 * update client sample spring-cloud #4091 * replace tabs * add beanvalidation annotations to spring #4091 * add tests for spring #4091 * cleanup spring-cloud (client lib) #4091 * update client sample spring-cloud #4091 * replace tabs * update spring-cloud sample
57 lines
2.9 KiB
Plaintext
57 lines
2.9 KiB
Plaintext
package {{package}};
|
|
|
|
{{#imports}}import {{import}};
|
|
{{/imports}}
|
|
|
|
import io.swagger.annotations.*;
|
|
{{#jdk8}}
|
|
import org.springframework.http.HttpStatus;
|
|
{{/jdk8}}
|
|
import org.springframework.http.ResponseEntity;
|
|
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.multipart.MultipartFile;
|
|
|
|
import java.util.List;
|
|
{{#async}}
|
|
import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}};
|
|
{{/async}}
|
|
{{#useBeanValidation}}
|
|
import javax.validation.constraints.*;
|
|
{{/useBeanValidation}}
|
|
{{>generatedAnnotation}}
|
|
@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API")
|
|
{{#operations}}
|
|
public interface {{classname}} {
|
|
{{#operation}}
|
|
|
|
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#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}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} })
|
|
@RequestMapping(value = "{{{path}}}",{{#singleContentTypes}}
|
|
produces = "{{{vendorExtensions.x-accepts}}}",
|
|
consumes = "{{{vendorExtensions.x-contentType}}}",{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}}
|
|
produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}}
|
|
consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}}
|
|
method = RequestMethod.{{httpMethod}})
|
|
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
|
|
{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} {
|
|
// do some magic!
|
|
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}};
|
|
}{{/jdk8}}
|
|
|
|
{{/operation}}
|
|
}
|
|
{{/operations}}
|