File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
scala-2/com/github/swagger/scala/converter
scala-3/com/github/swagger/scala/converter
test/scala/com/github/swagger/scala/converter Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,11 @@ private[converter] object ErasureHelper {
2727 val maybeClass : Option [Class [_]] = prop.typeSignature.typeArgs.headOption.flatMap { signature =>
2828 if (signature.typeSymbol.isClass) {
2929 signature.typeArgs.headOption match {
30- case Some (typeArg) => Option (mirror.runtimeClass(nestedTypeArg(typeArg)))
30+ case Some (typeArg) => {
31+ val resultType : universe.Type = nestedTypeArg(typeArg)
32+ val resultClass = mirror.runtimeClass(resultType)
33+ if (resultClass.isPrimitive) Option (resultClass) else None
34+ }
3135 case _ => Option (mirror.runtimeClass(signature))
3236 }
3337 } else {
Original file line number Diff line number Diff line change @@ -19,11 +19,14 @@ private[converter] object ErasureHelper {
1919 val results = classInfo.fields.flatMap { fieldInfo =>
2020 fieldInfo.fieldType match {
2121 case optionInfo : ScalaOptionInfo =>
22- Some (fieldInfo.name -> getInnerType(optionInfo.optionParamType).infoClass)
22+ val innerClass = getInnerType(optionInfo.optionParamType).infoClass
23+ if (innerClass.isPrimitive) Some (fieldInfo.name -> innerClass) else None
2324 case mapInfo : MapLikeInfo =>
24- Some (fieldInfo.name -> getInnerType(mapInfo.elementType2).infoClass)
25+ val innerClass = getInnerType(mapInfo.elementType2).infoClass
26+ if (innerClass.isPrimitive) Some (fieldInfo.name -> innerClass) else None
2527 case seqInfo : CollectionRType =>
26- Some (fieldInfo.name -> getInnerType(seqInfo.elementType).infoClass)
28+ val innerClass = getInnerType(seqInfo.elementType).infoClass
29+ if (innerClass.isPrimitive) Some (fieldInfo.name -> innerClass) else None
2730 case _ =>
2831 None
2932 }
Original file line number Diff line number Diff line change @@ -29,4 +29,7 @@ class ErasureHelperTest extends AnyFlatSpec with Matchers {
2929 it should " handle OptionSeqOptionLong" in {
3030 ErasureHelper .erasedOptionalPrimitives(classOf [OptionSeqOptionLong ]) shouldBe Map (" values" -> classOf [Long ])
3131 }
32+ it should " handle OptionSetString" in {
33+ ErasureHelper .erasedOptionalPrimitives(classOf [OptionSetString ]) shouldBe Map .empty
34+ }
3235}
You can’t perform that action at this time.
0 commit comments