I was able to solve my problem using a ModelConverter instead. I used a marker interface on the classes that I am interested in, and by substituting RefDataItem.class for them instead, I get the json-schema for that in the swagger instead.
Works nicely. I have now learnt that if the swagger annotations don't cut it, a custom ModelConverter is the way to do. I will need a few more of these converters to handle other tricky aspects of my model.
public Model resolve(Type type, ModelConverterContext modelConverterContext,
Iterator<ModelConverter> iterator) {
if (type instanceof SimpleType) {
SimpleType simpleType = (SimpleType) type;
Class<?> rawClass = simpleType.getRawClass();
if (EnumType.class.isAssignableFrom(rawClass)) {
SimpleType refDataType = SimpleType.construct(RefDataItem.class);
return super.resolve(refDataType, modelConverterContext, iterator);
}
}
return super.resolve(type, modelConverterContext, iterator);
}