-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for #729, added override of params with same name
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
modules/swagger-jaxrs/src/test/scala/DuplicateHeadersResourceTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import testresources._ | ||
|
||
import com.wordnik.swagger.jaxrs.reader._ | ||
import com.wordnik.swagger.core.util._ | ||
import com.wordnik.swagger.model._ | ||
import com.wordnik.swagger.config._ | ||
import com.wordnik.swagger.core.filter._ | ||
|
||
import java.lang.reflect.Method | ||
|
||
import java.util.Date | ||
|
||
import org.junit.runner.RunWith | ||
import org.scalatest.junit.JUnitRunner | ||
import org.scalatest.FlatSpec | ||
import org.scalatest.Matchers | ||
|
||
import scala.collection.mutable.ListBuffer | ||
|
||
@RunWith(classOf[JUnitRunner]) | ||
class DuplicateHeadersResourceTest extends FlatSpec with Matchers { | ||
it should "read an api and extract an error model" in { | ||
val reader = new DefaultJaxrsApiReader | ||
val config = new SwaggerConfig() | ||
val apiResource = reader.read("/api-docs", classOf[DuplicateHeadersResource], config).getOrElse(fail("should not be None")) | ||
val api = apiResource.apis.head | ||
val op = api.operations.head | ||
op.parameters.size should be (1) | ||
val param = op.parameters.head | ||
param.description.get should be ("This one!") | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
modules/swagger-jaxrs/src/test/scala/testresources/DuplicateHeadersResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package testresources; | ||
|
||
import testmodels.*; | ||
import com.wordnik.swagger.core.*; | ||
import com.wordnik.swagger.annotations.*; | ||
|
||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.Response; | ||
|
||
import javax.xml.bind.annotation.*; | ||
|
||
@Path("/basic") | ||
@Api(value = "/basic", description = "Basic resource") | ||
public class DuplicateHeadersResource { | ||
@ApiParam(value = "NOT this one!") | ||
@HeaderParam("auth_token") | ||
String header; | ||
|
||
@GET | ||
@Path("/{id}") | ||
@ApiOperation(value = "Find by ID") | ||
public JavaSample getTest( | ||
@ApiParam(value = "This one!")@HeaderParam("auth_token") String duplicate) { | ||
JavaSample out = new JavaSample(); | ||
out.setName("foo"); | ||
out.setValue("bar"); | ||
return out; | ||
} | ||
} |