Skip to content

Commit

Permalink
test for #770, fixed error message
Browse files Browse the repository at this point in the history
  • Loading branch information
fehguy committed Dec 21, 2014
1 parent 82ee92c commit 2f2caca
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,15 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im
case ComplexTypeMatcher(containerType, basePart) => {
LOGGER.debug("containerType: " + containerType + ", basePart: " + basePart + ", simpleName: " + simpleName)
paramType = containerType
val ComplexTypeMatcher(t, simpleTypeRef) = simpleName
val typeRef = {
if(simpleTypeRef.indexOf(",") > 0) // it's a map, use the value only
simpleTypeRef.split(",").last
else simpleTypeRef
val typeRef = simpleName match {
case ComplexTypeMatcher(t, simpleTypeRef) => {
if(simpleTypeRef.indexOf(",") > 0) // it's a map, use the value only
simpleTypeRef.split(",").last
else simpleTypeRef
}
case _ => simpleName
}

simpleName = containerType
if(isComplex(typeRef)) {
Some(ModelRef(null, Some(typeRef), Some(basePart)))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package converter


import com.wordnik.swagger.converter._
import com.wordnik.swagger.model._

import com.wordnik.swagger.annotations._
import com.wordnik.swagger.converter._
import com.wordnik.swagger.core.util._
import com.wordnik.swagger.model._

import scala.beans.BeanProperty

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.FlatSpec
import org.scalatest.Matchers

@RunWith(classOf[JUnitRunner])
class ByteConverterTest extends FlatSpec with Matchers {
val models = ModelConverters.read(classOf[ByteConverterModel])
JsonSerializer.asJson(models) should be ("""{"id":"ByteConverterModel","properties":{"myBytes":{"type":"array","items":{"type":"string"}}}}""")
}

class ByteConverterModel {
@ApiModelProperty(dataType="string")
@BeanProperty var myBytes:Array[Byte] = _
}

0 comments on commit 2f2caca

Please sign in to comment.