File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
main/scala/org/http4s/rho/swagger
test/scala/org/http4s/rho/swagger Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ object TypeBuilder {
196196 typeToProperty(tpe.typeArgs.head, sfs).withRequired(false )
197197 else if (tpe.isAnyVal && ! tpe.isPrimitive)
198198 typeToProperty(ptSym.asClass.primaryConstructor.asMethod.paramLists.flatten.head.typeSignature, sfs)
199- else if (isCaseClass(ptSym) || isSumType(ptSym))
199+ else if (isCaseClass(ptSym) || ( isSumType(ptSym) && ! isObjectEnum(ptSym) ))
200200 RefProperty (tpe.simpleName)
201201 else
202202 DataType .fromType(tpe) match {
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import java.util.Date
66import cats .effect .IO
77import cats .syntax .all ._
88import fs2 .Stream
9- import org .http4s .rho .swagger .models .AbstractProperty
9+ import org .http4s .rho .swagger .models .{ AbstractProperty , StringProperty }
1010import org .specs2 .execute .Result
1111import org .specs2 .mutable .Specification
1212import shapeless .{:+: , CNil }
@@ -415,6 +415,10 @@ class TypeBuilderSpec extends Specification {
415415 " Build a model for a case class containing a sealed enum" in {
416416 val ms = modelOf[SealedEnumContainer ]
417417 ms.size must_== 1
418+ val sealedEnumContainerModel = ms.head
419+ val e = sealedEnumContainerModel.properties(" e" )
420+ val enumProperty = e.asInstanceOf [StringProperty ]
421+ enumProperty.enums should_== Set (" FooEnum" , " BarEnum" )
418422 }
419423
420424 " Build a model for a type recursive through sealed trait" in {
You can’t perform that action at this time.
0 commit comments