Skip to content

Commit

Permalink
added hidden field for subresource support #633
Browse files Browse the repository at this point in the history
  • Loading branch information
fehguy committed Aug 28, 2014
1 parent 7a382d0 commit d9e4d98
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait ReaderUtil {
val tuples = listings.map(m => (m.resourcePath, m))
val grouped = tuples.groupBy(_._1)
(for (group <- grouped) yield {
val apiDescriptions = (for(g <- group._2; api <- g._2.apis) yield api).toList
val apiDescriptions = (for(g <- group._2; api <- g._2.apis) yield api).filter(_.hidden == false).toList
val models = (for(g <- group._2; models <- g._2.models) yield models).flatten.toMap
group._2(0)._2.copy(apis = apiDescriptions, models = Option(models))
}).toList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ case class ApiListing (
case class ApiDescription (
path: String,
description: Option[String],
operations: List[Operation] = List())
operations: List[Operation] = List(),
hidden: Boolean = false)

case class Operation (
method: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ class BasicJaxrsReader extends JaxrsApiReader {
parentMethods: ListBuffer[Method]): Option[ApiListing] = {
val api = cls.getAnnotation(classOf[Api])
val pathAnnotation = cls.getAnnotation(classOf[Path])
var hidden = false

val r = Option(api) match {
case Some(api) => api.value
case Some(api) => {
hidden = api.hidden
api.value
}
case None => Option(pathAnnotation) match {
case Some(p) => p.value
case None => null
Expand Down Expand Up @@ -108,7 +112,8 @@ class BasicJaxrsReader extends JaxrsApiReader {
ApiDescription(
addLeadingSlash(endpoint),
None,
orderedOperations.toList)
orderedOperations.toList,
hidden)
}).toList
val models = ModelUtil.modelsFromApis(apis)
Some(ApiListing (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class DefaultJaxrsApiReader extends JaxrsApiReader {
ApiDescription(
addLeadingSlash(endpoint),
None,
orderedOperations.toList)
orderedOperations.toList,
hidden = api.hidden)
}).toList

val basePath = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class JerseyApiReader extends JaxrsApiReader {
ApiDescription(
addLeadingSlash(endpoint),
None,
orderedOperations.toList)
orderedOperations.toList,
api.hidden)
}).toList
val models = ModelUtil.modelsFromApis(apis)
val basePath = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class JerseyApiReader extends JaxrsApiReader {
ApiDescription(
addLeadingSlash(endpoint),
None,
orderedOperations.toList)
orderedOperations.toList,
api.hidden)
}).toList
val models = ModelUtil.modelsFromApis(apis)
val basePath = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import javax.ws.rs.*;

@Path("/owner")
@Api(value = "/owner", description = "Operations about the owners", position = 1)
@Api(hidden = true, value = "/owner", description = "Operations about the owners", position = 1)
@Produces("application/json")
public class OwnerResource {
private String petId;
Expand Down

This file was deleted.

0 comments on commit d9e4d98

Please sign in to comment.