swagger-scala-module icon indicating copy to clipboard operation
swagger-scala-module copied to clipboard

Support traits

Open aggenebbisj opened this issue 7 years ago • 1 comments

Traits do not seem to be picked up automatically.

If I have the following:

sealed trait Foo(x: Int)
case class Bar(x: Int) extends Foo

the generated Swagger definition is:

Foo: {
  type: "object"
}

I would expect the property x to be there as well.

aggenebbisj avatar Feb 15 '18 14:02 aggenebbisj

I think it needs to be a "java bean" getter, e.g.

@ApiModel(value = "foo")
trait Foo {
  @ApiModelProperty(value = "x", dataType = "integer", required = true, readOnly = true)
  def getX: Int
}

You might also make use of @scala.annotation.meta.beanGetter

(btw your code is not valid scala, unless you're using dotty or something)

dwickern avatar Feb 16 '18 21:02 dwickern