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

I need help! SubTypes not effective!

Open guozhao265 opened this issue 3 years ago • 0 comments

Now i have the this situation: BillDetailView is the base class,and KkbRelatedBillDetailView/RemunerationBillDetailView are two son classes. i want sync this api model to yapi. ` @ApiModel( discriminator = "settlementType", description = "base model", subTypes = [KkbRelatedBillDetailView::class, RemunerationBillDetailView::class] ) interface BillDetailView { val settlementType: Int }

@ApiModel(description = "kkb related bill model", parent = BillDetailView::class) data class KkbRelatedBillDetailView( @ApiModelProperty(value = "orignal") var originalSettlementAmount: String, @ApiModelProperty(value = "settlement type", required = true) override val settlementType: Int, ) : BillDetailView {}

@ApiModel(description = "remuneration bill model", parent = BillDetailView::class) data class RemunerationBillDetailView( @ApiModelProperty(value = "advance amount") var advanceAmount: String, @ApiModelProperty(value = "settlement type", required = true) override val settlementType: Int, ) : BillDetailView {} `

my code is in Kotlin, according to swagger-core user guide(https://github.com/swagger-api/swagger-core/wiki/Annotations#apimodel),i used subTypes and discriminator,and parent annotations, is there something wrong with my code? waiting for your help, thanks.

guozhao265 avatar Jul 27 '22 10:07 guozhao265