All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.kongchen.swagger.docgen.EnhancedSwaggerAnnotationIntrospector Maven / Gradle / Ivy

Go to download

A maven build plugin which helps you generate API document during build phase

There is a newer version: 3.1.8
Show newest version
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);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy