com.github.kongchen.swagger.docgen.EnhancedSwaggerAnnotationIntrospector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swagger-maven-plugin
Show all versions of swagger-maven-plugin
A maven build plugin which helps you generate API document during build phase
package com.github.kongchen.swagger.docgen;
import com.fasterxml.jackson.databind.PropertyName;
import com.fasterxml.jackson.databind.introspect.AnnotatedClass;
import io.swagger.annotations.ApiModel;
import io.swagger.jackson.SwaggerAnnotationIntrospector;
/**
* Extends SwaggerAnnotationIntrospector with {@link #findRootName(AnnotatedClass)} implementation. See
* https://github.com/swagger-api/swagger-core/issues/2104
*
* @author Tomasz Juchniewicz
*
*/
public class EnhancedSwaggerAnnotationIntrospector extends SwaggerAnnotationIntrospector {
@Override
public PropertyName findRootName(AnnotatedClass ac) {
ApiModel model = ac.getAnnotation(ApiModel.class);
if (model != null) {
return new PropertyName(model.value());
} else {
return super.findRootName(ac);
}
}
}