Skip to content

Commit

Permalink
Made the swagger resource prefix configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed May 11, 2017
1 parent 66381c2 commit 90251da
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -1263,7 +1264,7 @@ private static boolean isValidResponse(Type type) {

if( cls != null )
{
if( cls.isAssignableFrom(ServerResponse.class) || cls.isAssignableFrom(CompletableFuture.class))
if( cls.isAssignableFrom(ServerResponse.class) || cls.isAssignableFrom(CompletableFuture.class) || cls.isAssignableFrom(ByteBuffer.class))
{
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/sinistral/proteus/services/BaseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import com.typesafe.config.Config;

/**
* An abstract base class for a Proteus service.
*
* @author jbauer
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ public class SwaggerService extends BaseService implements Supplier<RoutingHan

protected final String swaggerResourcePathPrefix = "swagger";

protected final String swaggerResourcePrefix = "io/sinistral/proteus/swagger";


protected Swagger swagger = null;

protected String swaggerSpec = null;

protected String swaggerIndexHTML = null;


@Inject
@Named("swagger.resourcePrefix")
protected String swaggerResourcePrefix;

@Inject
@Named("swagger.basePath")
protected String swaggerBasePath;
Expand Down
13 changes: 13 additions & 0 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,39 @@ globalHeaders


assets {
# the base path assets will be server from
path = "/public"
# the directory to load the assets from
dir = "./assets"
cache {
# cache timeout for the assets
time = 500
}
}



swagger {
# the path that has an index.html template and theme css files
resourcePrefix="io/sinistral/proteus/swagger"
# swagger version
swagger: "2.0"
info {
# swagger info title
title = ${application.name}
# swagger info version
version = ${application.version}
}
# swagger-ui theme from ostranme's swagger-ui-themes, the following are built-in [feeling-blue, flattop, material, monokai, muted, newspaper, outline]
# specifying a different name causes the SwaggerService to search in {swagger.resourcePrefix}/themes for a file named "theme-{swagger.theme}.css"
theme="default"
# where the swagger endpoints will be mounted
basePath= ${application.path}"/swagger"
#the name of the spec file
specFilename="swagger.json"
consumes = ["application/json"]
produces = ["application/json"]
# supported schemes
schemes = ["http"]
}

Expand Down

0 comments on commit 90251da

Please sign in to comment.