Skip to content

Commit

Permalink
fix for #729, added override of params with same name
Browse files Browse the repository at this point in the history
  • Loading branch information
fehguy committed Dec 21, 2014
1 parent e4506a6 commit 6305cca
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
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!")
}
}
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;
}
}

0 comments on commit 6305cca

Please sign in to comment.