File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
main/scala/com/github/swagger/scala/converter
com/github/swagger/scala/converter Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ class SwaggerScalaModelConverter extends ModelResolver(SwaggerScalaModelConverte
252252 propNamesSet.contains(key)
253253 }
254254 if (originalProps.size > newProps.size) {
255- schema.setProperties(newProps.asJava)
255+ schema.setProperties(new util. LinkedHashMap ( newProps.asJava) )
256256 }
257257 }
258258
Original file line number Diff line number Diff line change @@ -594,6 +594,16 @@ class ModelPropertyParserTest extends AnyFlatSpec with BeforeAndAfterEach with M
594594 nullSafeSeq(model.value.getRequired) shouldEqual Seq (" amount" )
595595 }
596596
597+ it should " process ModelWGetFunction with optional field" in new PropertiesScope [ModelWGetFunctionWithOptionalField ] {
598+ val props = nullSafeMap(model.value.getProperties)
599+ props should have size 1
600+ val amountField = props.get(" amount" ).value
601+ amountField shouldBe a[IntegerSchema ]
602+ amountField.asInstanceOf [IntegerSchema ].getFormat shouldEqual " int64"
603+
604+ nullSafeSeq(model.value.getRequired) shouldBe empty
605+ }
606+
597607 it should " process ModelWJacksonAnnotatedGetFunction" in new PropertiesScope [ModelWJacksonAnnotatedGetFunction ] {
598608 val props = nullSafeMap(model.value.getProperties)
599609 props should have size 1
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ case class ModelWGetFunction(amount: Long) {
66 def getOptionalAmount (): Option [Long ] = Some (amount)
77}
88
9+ case class ModelWGetFunctionWithOptionalField (amount : Option [Long ]) {
10+ def getOptionalAmount (): Option [Long ] = amount
11+ }
12+
913case class ModelWJacksonAnnotatedGetFunction (amount : Long ) {
1014 @ JsonIgnore def getOptionalAmount (): Option [Long ] = Some (amount)
1115}
You can’t perform that action at this time.
0 commit comments