-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Closed
Copy link
Description
Swagger version is 1.5.2 (the same issue in 1.5.4-SNAPSHOT).
Derived classes (UrlProperty and ValueProperty) from the listing below are not added to Swagger definition:
@ApiModel("MyProperty")
@JsonSubTypes({@JsonSubTypes.Type(value = UrlProperty.class), @JsonSubTypes.Type(value = ValueProperty.class)})
public static abstract class AbstractProperty {
final String type;
protected AbstractApiProperty(String type) {
this.type = type;
}
public String getType() {
return type;
}
}
public static class UrlProperty extends AbstractProperty {
final URL url;
public UrlProperty(String type, String url) {
super(type);
try {
this.url = new URL(url);
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e);
}
}
public URL getUrl() {
return url;
}
}
public static class ValueProperty extends AbstractProperty {
final String value;
public ValueProperty(String type, String value) {
super(type);
this.value = value;
}
public String getValue() {
return value;
}
}
To get UrlProperty and ValueProperty in Swagger definition I have to remove the @ApiModel annotation from the declaration of the base class (AbstractProperty) or add @ApiModel without arguments to all derived classes.
Metadata
Metadata
Assignees
Labels
No labels