eclipse / microprofile-open-api

Microprofile open api
Apache License 2.0
131 stars 82 forks source link

Can't get Schema annotation to show up in swagger #449

Closed lamikam100 closed 2 years ago

lamikam100 commented 3 years ago

Hi I have setup a project and it is hosting a swagger 3 ui in it. JAXB classes are created with the plugin from the xsd files, and If I look at one of the generated java files, it looks correct, example:

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
. . .
@ApiModel(value = "Account", description = "com.hsntech.banner.us.hsn.payload.Account description generated by jaxb-swagger, hence no class description yet.")
@Schema(name = "Account", description = "com.hsntech.banner.us.hsn.payload.Account")
public class Account {

    @XmlElement(name = "AccountID", required = true)
    @Schema(name = "accountID", title = "accountID", description = "Unique Account ID. Banner has concept of an account and account ID is Customer Number + Premise Number", required = true, maxLength = 60)
    protected String accountID;

but when I browse to the openapi and look at the model, the annotations for "description", etc do not show up. Any suggestions? thanks

phillip-kruger commented 3 years ago

I don't think you can mix microprofile open api and swagger annotations. Change all io.swagger.* to the microprofile annotations. What runtime are you using ?

MikeEdgar commented 2 years ago

@lamikam100 re-open if you have any further question on this one. As @phillip-kruger mentioned, mixing the annotation libraries is not supported.