forked from loafle/openapi-generator-original
54 lines
2.9 KiB
Plaintext
54 lines
2.9 KiB
Plaintext
package {{package}};
|
|
|
|
{{#imports}}import {{import}};
|
|
{{/imports}}
|
|
|
|
import io.swagger.annotations.*;
|
|
{{#java8}}
|
|
import org.springframework.http.HttpStatus;
|
|
{{/java8}}
|
|
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.{{^java8}}Callable{{/java8}}{{#java8}}CompletableFuture{{/java8}};
|
|
{{/async}}
|
|
|
|
{{>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}})
|
|
{{#java8}}default {{/java8}}{{#async}}{{^java8}}Callable{{/java8}}{{#java8}}CompletableFuture<{{/java8}}{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^java8}};{{/java8}}{{#java8}} {
|
|
// do some magic!
|
|
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}};
|
|
}{{/java8}}
|
|
|
|
{{/operation}}
|
|
}
|
|
{{/operations}}
|