Skip to content

Commit 6305cca

Browse files
committed
fix for #729, added override of params with same name
1 parent e4506a6 commit 6305cca

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import testresources._
2+
3+
import com.wordnik.swagger.jaxrs.reader._
4+
import com.wordnik.swagger.core.util._
5+
import com.wordnik.swagger.model._
6+
import com.wordnik.swagger.config._
7+
import com.wordnik.swagger.core.filter._
8+
9+
import java.lang.reflect.Method
10+
11+
import java.util.Date
12+
13+
import org.junit.runner.RunWith
14+
import org.scalatest.junit.JUnitRunner
15+
import org.scalatest.FlatSpec
16+
import org.scalatest.Matchers
17+
18+
import scala.collection.mutable.ListBuffer
19+
20+
@RunWith(classOf[JUnitRunner])
21+
class DuplicateHeadersResourceTest extends FlatSpec with Matchers {
22+
it should "read an api and extract an error model" in {
23+
val reader = new DefaultJaxrsApiReader
24+
val config = new SwaggerConfig()
25+
val apiResource = reader.read("/api-docs", classOf[DuplicateHeadersResource], config).getOrElse(fail("should not be None"))
26+
val api = apiResource.apis.head
27+
val op = api.operations.head
28+
op.parameters.size should be (1)
29+
val param = op.parameters.head
30+
param.description.get should be ("This one!")
31+
}
32+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package testresources;
2+
3+
import testmodels.*;
4+
import com.wordnik.swagger.core.*;
5+
import com.wordnik.swagger.annotations.*;
6+
7+
import javax.ws.rs.*;
8+
import javax.ws.rs.core.Response;
9+
10+
import javax.xml.bind.annotation.*;
11+
12+
@Path("/basic")
13+
@Api(value = "/basic", description = "Basic resource")
14+
public class DuplicateHeadersResource {
15+
@ApiParam(value = "NOT this one!")
16+
@HeaderParam("auth_token")
17+
String header;
18+
19+
@GET
20+
@Path("/{id}")
21+
@ApiOperation(value = "Find by ID")
22+
public JavaSample getTest(
23+
@ApiParam(value = "This one!")@HeaderParam("auth_token") String duplicate) {
24+
JavaSample out = new JavaSample();
25+
out.setName("foo");
26+
out.setValue("bar");
27+
return out;
28+
}
29+
}

0 commit comments

Comments
 (0)