Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional CSV parameters rendered incorrectly in the Swagger #257

Open
carwynellis opened this issue Oct 9, 2018 · 2 comments
Open

Optional CSV parameters rendered incorrectly in the Swagger #257

carwynellis opened this issue Oct 9, 2018 · 2 comments
Labels

Comments

@carwynellis
Copy link

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.

zarthross added a commit that referenced this issue Oct 9, 2018
@zarthross zarthross added the bug label Oct 9, 2018
@carwynellis
Copy link
Author

Awesome! Thanks for getting a fix in so quickly!

@RafalSumislawski
Copy link
Member

@zarthross I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants