Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Option[T] not entirely supported #180

Open
gaeljw opened this issue Jul 26, 2018 · 1 comment
Open

Option[T] not entirely supported #180

gaeljw opened this issue Jul 26, 2018 · 1 comment

Comments

@gaeljw
Copy link

gaeljw commented Jul 26, 2018

Hi,

Having an implicit body parameter which definition looks like this:

case class SomeDTO(
  name: Option[String],
  aLong: Option[Long],
  aFloat: Option[Float],
  aBoolean: Option[Boolean]
)

And declaration:

@ApiImplicitParams(Array(
    new ApiImplicitParam(value = "xxx", paramType = "body", dataType = "dto.SomeDTO", required = true)
  ))

Result in the following swagger.json file:

"SomeDTO" : {
      "type" : "object",
      "properties" : {
        "name" : {
          "type" : "string"
        },
        "aLong" : {
          "type" : "object"
        },
        "aFloat" : {
          "type" : "object"
        },
        "aBoolean" : {
          "type" : "object"
        }
      }
    },

That is, Option[String] is correctly mapped to string but other Option[Long], Option[Float] and Option[Boolean] are mapped to object which is not correct. They should be mapped to number and boolean.

And then, in the UI, examples for this type are not well presented.

NB: I haven't tested if it's specific to implicit and/or body params or not.

@gaeljw
Copy link
Author

gaeljw commented Jul 26, 2018

Depends on swagger-api/swagger-scala-module#55

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

No branches or pull requests

1 participant