Skip to content

Commit eb2579c

Browse files
committed
add test stub
1 parent 0a4d848 commit eb2579c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,17 +472,27 @@ class ModelPropertyParserTest extends AnyFlatSpec with BeforeAndAfterEach with M
472472
it should "default to supplied schema if it can't be corrected" in new PropertiesScope[ModelWMapStringCaseClass] {
473473
schemas should have size 2
474474

475+
nullSafeSeq(model.value.getRequired) shouldBe empty
475476
val mapField = model.value.getProperties.get("maybeMapStringCaseClass")
476477
mapField shouldBe a[MapSchema]
477478
mapField.getAdditionalProperties shouldBe a[Schema[_]]
478479
mapField.getAdditionalProperties.asInstanceOf[Schema[_]].get$ref() shouldBe "#/components/schemas/SomeCaseClass"
479480

480-
481481
val caseClassField = schemas("SomeCaseClass")
482482
caseClassField shouldBe a[Schema[_]]
483483
caseClassField.getProperties.get("field") shouldBe an[IntegerSchema]
484484
}
485485

486+
it should "handle Option[Map[String, Long]]" in new PropertiesScope[ModelWMapStringLong] {
487+
schemas should have size 1
488+
489+
nullSafeSeq(model.value.getRequired) shouldBe empty
490+
val mapField = model.value.getProperties.get("maybeMapStringLong")
491+
mapField shouldBe a[MapSchema]
492+
nullSafeMap(mapField.getProperties) shouldBe empty
493+
mapField.getAdditionalProperties shouldBe a[Schema[_]]
494+
}
495+
486496
it should "process Model with Scala Seq" in new PropertiesScope[ModelWSeqString] {
487497
schemas should have size 1
488498
val stringsField = model.value.getProperties.get("strings")

src/test/scala/models/ModelWSeqString.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ case class SomeCaseClass(field: Int)
1212

1313
case class ModelWMapStringCaseClass(maybeMapStringCaseClass: Option[Map[String, SomeCaseClass]])
1414

15+
case class ModelWMapStringLong(maybeMapStringLong: Option[Map[String, Long]])
16+
1517
case class ModelWJavaMapString(strings: java.util.Map[String, String])

0 commit comments

Comments
 (0)