swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Model not created for an abstract base model with sub-types

Open gorgonblot opened this issue 11 years ago • 3 comments

The SwaggerSchemaConverter read method returns None as the model if the model does not define any fields even if the model defines sub-types. For example, assume an API references an abstract base model without any fields. It references one or more subTypes.

@ApiModel(description = "I am an Abstract Base Model without any declared fields and with Sub-Types", subTypes = Array(classOf[Thing3])) trait AbstractBaseModelWithoutFields { }

@ApiModel(description = "Thing3", parent = classOf[AbstractBaseModelWithoutFields]) case class Thing3( @(ApiModelProperty @field)(value = "Additional field a") a: String, @(ApiModelProperty @field)(value = "Additional field x") x: Int) extends AbstractBaseModelWithoutFields

The desired behavior is for ModelConverters.readAll(classOf[AbstractBaseModelWithoutFields]) to return a list of models including both the base model and the sub-type.

The current behavior is that readAll returns an empty list.

A pull request to address this issue is forthcoming.

gorgonblot avatar Feb 02 '15 15:02 gorgonblot

Guys, what's the ETA for the fix of this ?

unoexperto avatar Apr 06 '15 14:04 unoexperto

Hope to fix today or tomorrow.

MDoumin avatar Apr 09 '15 09:04 MDoumin

This should be addressed in #975

fehguy avatar Apr 21 '15 00:04 fehguy