-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
I find the swagger-jersey2-jaxrs is not merging the ApiListing with same names, so if I have two APIs with same @Api("myapis") annotation, only one will show.
If find the swagger-jaxrs code deals with it and copied to swagger-jersey2-jaxrs.
diff --git a/modules/swagger-jersey2-jaxrs/src/main/scala/com/wordnik/swagger/jersey/listing/ApiListing.scala b/modules/swagger-jersey2-jaxrs/src/main/scala/com/wordnik/swagger/jersey/listing/ApiListing.scala
index d9973ad..5e0974d 100644
--- a/modules/swagger-jersey2-jaxrs/src/main/scala/com/wordnik/swagger/jersey/listing/ApiListing.scala
+++ b/modules/swagger-jersey2-jaxrs/src/main/scala/com/wordnik/swagger/jersey/listing/ApiListing.scala
@@ -26,7 +26,7 @@ import scala.collection.mutable.LinkedHashMap
import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer
-object ApiListingCache {
+object ApiListingCache extends ReaderUtil {
private val LOGGER = LoggerFactory.getLogger(ApiListingCache.getClass)
var _cache: Option[Map[String, ApiListing]] = None
@@ -42,7 +42,8 @@ object ApiListingCache {
}
// For each top level resource, parse it and look for swagger annotations.
val listings = (for(cls <- classes) yield reader.read(docRoot, cls, ConfigFactory.config)).flatten.toList
- _cache = Some((listings.map(m => {
+ val mergedListings = groupByResourcePath(listings)
+ _cache = Some((mergedListings.map(m => {
// always start with "/"
val resourcePath = m.resourcePath.startsWith ("/") match {
case true => m.resourcePath
Metadata
Metadata
Assignees
Labels
No labels