Skip to content

Commit 78781e7

Browse files
committed
tests for #1041
1 parent 8bfc5ca commit 78781e7

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

modules/swagger-jaxrs/src/test/scala/SimpleScannerTest.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,17 @@ class SimpleScannerTest extends FlatSpec with Matchers {
353353
param.getName() should be ("id")
354354
param.isInstanceOf[PathParameter] should be (true)
355355
}
356+
357+
it should "verify top-level path params per #1085" in {
358+
val swagger = new Reader(new Swagger()).read(classOf[Resource1041])
359+
val path1 = swagger.getPaths().get("/external/info/path1").getGet()
360+
val security1 = path1.getSecurity()
361+
security1.size should be (1)
362+
security1.get(0).get("my_auth") should not be (null)
363+
364+
val path2 = swagger.getPaths().get("/external/info/path2").getGet()
365+
val security2 = path2.getSecurity()
366+
security2.size should be (1)
367+
security2.get(0).get("your_auth") should not be (null)
368+
}
356369
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package resources;
2+
3+
import com.wordnik.swagger.annotations.*;
4+
5+
import javax.ws.rs.*;
6+
import javax.ws.rs.core.Response;
7+
8+
import java.util.*;
9+
10+
@Api(value = "/external/info/", authorizations = @Authorization("my_auth"))
11+
@Path("external/info/")
12+
public class Resource1041 {
13+
@ApiOperation(value = "test")
14+
@GET
15+
@Path("/path1")
16+
public void getTest(@ApiParam(value = "test") ArrayList<String> tenantId) {
17+
return;
18+
}
19+
20+
@ApiOperation(value = "test", authorizations = @Authorization("your_auth"))
21+
@GET
22+
@Path("/path2")
23+
public void getTest2(@ApiParam(value = "test") ArrayList<String> tenantId) {
24+
return;
25+
}
26+
}

0 commit comments

Comments
 (0)