tweaks for swagger

This commit is contained in:
Athou
2013-04-15 22:24:37 +02:00
parent a9eb2595fe
commit e124fdbe8f
23 changed files with 57 additions and 15 deletions

View File

@@ -39,6 +39,7 @@ import com.commafeed.backend.feeds.FeedFetcher;
import com.commafeed.backend.feeds.OPMLImporter;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserRole.Role;
import com.commafeed.backend.services.ApplicationSettingsService;
import com.commafeed.backend.services.FeedSubscriptionService;
import com.commafeed.backend.services.PasswordEncryptionService;
import com.commafeed.backend.services.UserService;
@@ -60,6 +61,9 @@ public abstract class AbstractREST extends JavaHelp {
@Context
HttpServletResponse response;
@Inject
ApplicationSettingsService applicationSettingsService;
@Inject
FeedDAO feedDAO;
@@ -165,7 +169,8 @@ public abstract class AbstractREST extends JavaHelp {
@ApiOperation(value = "Returns information about API parameters", responseClass = "com.wordnik.swagger.core.Documentation")
public Response getHelp(@Context ServletConfig sc,
@Context HttpHeaders headers, @Context UriInfo uriInfo) {
return super.getHelp(new ServletConfigProxy(sc), headers, uriInfo);
return super.getHelp(new ServletConfigProxy(applicationSettingsService
.get().getPublicUrl(), sc), headers, uriInfo);
}
}

View File

@@ -43,14 +43,14 @@ public class EntriesREST extends AbstractREST {
@Path("/get")
@GET
@ApiOperation(value = "Find entry by ID", notes = "Add extra notes here", responseClass = "com.commafeed.frontend.model.Entries")
@ApiOperation(value = "Get entries", notes = "Get a list of entries matching the query", responseClass = "com.commafeed.frontend.model.Entries")
public Entries getEntries(
@ApiParam(value = "ID of entry that needs to be fetched", allowableValues = "range[1,5]", required = true) @QueryParam("type") Type type,
@QueryParam("id") String id,
@QueryParam("readType") ReadType readType,
@DefaultValue("0") @QueryParam("offset") int offset,
@DefaultValue("-1") @QueryParam("limit") int limit,
@QueryParam("order") @DefaultValue("desc") ReadingOrder order) {
@ApiParam(value = "Type of query", allowableValues = "category,feed", required = true) @QueryParam("type") Type type,
@ApiParam(value = "ID of the category or the feed", required = true) @QueryParam("id") String id,
@ApiParam(value = "All entries or only unread ones", allowableValues = "all,unread", required = true) @QueryParam("readType") ReadType readType,
@ApiParam(value = "Offset for paging") @DefaultValue("0") @QueryParam("offset") int offset,
@ApiParam(value = "Limit for paging") @DefaultValue("-1") @QueryParam("limit") int limit,
@ApiParam(value = "Ordering", allowableValues = "asc,desc") @QueryParam("order") @DefaultValue("desc") ReadingOrder order) {
Preconditions.checkNotNull(type);
Preconditions.checkNotNull(id);