File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
com/github/swagger/scala/converter Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff 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" )
Original file line number Diff line number Diff line change @@ -12,4 +12,6 @@ case class SomeCaseClass(field: Int)
1212
1313case class ModelWMapStringCaseClass (maybeMapStringCaseClass : Option [Map [String , SomeCaseClass ]])
1414
15+ case class ModelWMapStringLong (maybeMapStringLong : Option [Map [String , Long ]])
16+
1517case class ModelWJavaMapString (strings : java.util.Map [String , String ])
You can’t perform that action at this time.
0 commit comments