Skip to content

Commit

Permalink
Improve Swagger css.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed May 23, 2017
1 parent 77e446d commit f8dd4f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,30 @@ else if (t.equals(HttpServerExchange.class) || t.equals(ServerRequest.class))

List<String> consumesContentTypes = new ArrayList<>();
List<String> producesContentTypes = new ArrayList<>();

/*
* Controller Level Authorization
*/

List<String> typeLevelSecurityDefinitions = new ArrayList<>();

if( Optional.ofNullable(clazz.getAnnotation(io.swagger.annotations.Api.class)).isPresent() )
{
io.swagger.annotations.Api apiAnnotation = clazz.getAnnotation(io.swagger.annotations.Api.class);

io.swagger.annotations.Authorization[] authorizationAnnotations = apiAnnotation.authorizations();

if(authorizationAnnotations.length > 0)
{
for(io.swagger.annotations.Authorization authorizationAnnotation: authorizationAnnotations )
{
if(authorizationAnnotation.value().length() > 0)
{
typeLevelSecurityDefinitions.add(authorizationAnnotation.value());
}
}
}
}

for (Method m : clazz.getDeclaredMethods())
{
Expand Down Expand Up @@ -1077,6 +1101,8 @@ else if (producesContentType.contains(MediaType.TEXT_HTML))

List<String> securityDefinitions = new ArrayList<>();

securityDefinitions.addAll(typeLevelSecurityDefinitions);

if( Optional.ofNullable(m.getAnnotation(io.swagger.annotations.ApiOperation.class)).isPresent() )
{
io.swagger.annotations.ApiOperation apiOperationAnnotation = m.getAnnotation(io.swagger.annotations.ApiOperation.class);
Expand Down
Loading

0 comments on commit f8dd4f5

Please sign in to comment.