Skip to content

Commit 6477a27

Browse files
committed
Update SpringMVC template to include Authorization annotations
1 parent 300a0dc commit 6477a27

File tree

1 file changed

+9
-1
lines changed
  • modules/swagger-codegen/src/main/resources/JavaSpringMVC

1 file changed

+9
-1
lines changed

modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import io.swagger.annotations.ApiOperation;
1010
import io.swagger.annotations.ApiParam;
1111
import io.swagger.annotations.ApiResponse;
1212
import io.swagger.annotations.ApiResponses;
13+
import io.swagger.annotations.Authorization;
14+
import io.swagger.annotations.AuthorizationScope;
1315

1416
import org.springframework.http.HttpStatus;
1517
import org.springframework.http.ResponseEntity;
@@ -35,7 +37,13 @@ import static org.springframework.http.MediaType.*;
3537
public class {{classname}} {
3638
{{#operation}}
3739

38-
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}})
40+
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
41+
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
42+
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
43+
{{/hasMore}}{{/scopes}}
44+
}{{/isOAuth}}){{#hasMore}},
45+
{{/hasMore}}{{/authMethods}}
46+
}{{/hasAuthMethods}})
3947
@ApiResponses(value = { {{#responses}}
4048
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},{{/hasMore}}{{/responses}} })
4149
@RequestMapping(value = "{{path}}",

0 commit comments

Comments
 (0)