Skip to content

Commit eccadc8

Browse files
author
PJ Fanning
committed
add ModelWOptionBooleanSchemaOverride test
1 parent 5d31d6e commit eccadc8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/test/scala/com/github/swagger/scala/converter/ModelPropertyParserTest.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ class ModelPropertyParserTest extends FlatSpec with Matchers {
134134
nullSafeList(model.get.getRequired) shouldBe empty
135135
}
136136

137+
it should "process Model with Scala Option Boolean with Schema Override" in {
138+
val converter = ModelConverters.getInstance()
139+
val schemas = converter.readAll(classOf[ModelWOptionBooleanSchemaOverride]).asScala.toMap
140+
val model = schemas.get("ModelWOptionBooleanSchemaOverride")
141+
model should be ('defined)
142+
model.get.getProperties should not be (null)
143+
val optBoolean = model.get.getProperties().get("optBoolean")
144+
optBoolean should not be (null)
145+
optBoolean shouldBe a [BooleanSchema]
146+
nullSafeList(model.get.getRequired) shouldBe empty
147+
}
148+
137149
it should "process all properties as required barring Option[_] or if overridden in annotation" in {
138150
val schemas = ModelConverters
139151
.getInstance()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
package models
22

3+
import io.swagger.v3.oas.annotations.media.Schema
4+
35
case class ModelWOptionBoolean(optBoolean: Option[Boolean])
6+
7+
case class ModelWOptionBooleanSchemaOverride(@Schema(implementation = classOf[Boolean]) optBoolean: Option[Boolean])

0 commit comments

Comments
 (0)