rho icon indicating copy to clipboard operation
rho copied to clipboard

Optional CSV parameters rendered incorrectly in the Swagger

Open carwynellis opened this issue 7 years ago • 2 comments

Apologies if this issue has been reported before but I couldn't find any issues open or closed covering this.

We have an optional CSV field on our API e.g.

param[Option[Seq[String]]]("ids")

However the parameter in the swagger is rendered as

{
 "name" : "foo",
 "in" : "query",
 "required" : false,
 "type" : "array",
 "items" : {
   "type" : "List"
 }
},

instead of

{
  "name" : "foo",
  "in" : "query",
  "required" : false,
  "type" : "array",
  "items" : {
    "type" : "string"
  }
},

Note that we need this parameter to be optional in the swagger e.g. "required": false.

If the parameter is defined as param[Seq[String]]("ids") then the swagger definition shows the correct type, e.g. array with items of type string, but the required property is then true.

The issue seems to be that during the swagger generation the type traversal of the Option[Seq[String]] stops at the Seq and doesn't continue to identify the actual type of the items.

carwynellis avatar Oct 09 '18 08:10 carwynellis

Awesome! Thanks for getting a fix in so quickly!

carwynellis avatar Oct 11 '18 13:10 carwynellis

@zarthross I think this issue can be closed.

RafalSumislawski avatar Oct 08 '19 15:10 RafalSumislawski