swagger-api / swagger-play

Apache License 2.0
330 stars 181 forks source link

Option[ ... ] Interpreted as Array[ ... ] in the data type schema #105

Closed marcus-degruttola closed 7 years ago

marcus-degruttola commented 7 years ago

Our class ...

case class DataRequestPost( widget_ids: Option[Array[String]], learner_ids: Option[Array[String]], date_start: Option[String], date_end: Option[String], email: Option[String])

... is being interpreted as ...

{ "widget_ids": [ [ "string" ] ], "learner_ids": [ [ "string" ] ], "date_start": [ "string" ], "date_end": [ "string" ], "email": [ "string" ] }

... when it should be ...

{ "widget_ids": [ "string" ], "learner_ids": [ "string" ], "date_start": "string", "date_end": "string", "email": "string" }

Earlier versions of the play-swagger integration handled this correctly. Better still if the Option type triggered the handling of the optional tag correctly. Here's the model view of the same.

DataRequestPost { widget_ids (Array[Inline Model 1], optional), learner_ids (Array[Inline Model 2], optional), date_start (Array[string], optional), date_end (Array[string], optional), email (Array[string], optional) } Inline Model 1 [ string ] Inline Model 2 [ string ]

marcus-degruttola commented 7 years ago

Fixed in 1.5.2... I should have checked...