package org.craftercms.profile.utils.swagger;
import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
import com.mangofactory.swagger.models.dto.ApiInfo;
import com.mangofactory.swagger.plugin.EnableSwagger;
import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Spring config for Swagger.
*
* @author avasquez
*/
@Configuration
@EnableSwagger
public class SwaggerConfig {
private SpringSwaggerConfig springSwaggerConfig;
@Autowired
public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig) {
this.springSwaggerConfig = springSwaggerConfig;
}
@Bean(name = "crafter.swaggerConfigPlugin")
public SwaggerSpringMvcPlugin customImplementation(){
return new SwaggerSpringMvcPlugin(springSwaggerConfig)
.apiInfo(apiInfo())
.includePatterns("/api/.*");
}
private ApiInfo apiInfo() {
ApiInfo apiInfo = new ApiInfo(
"Crafter Profile REST API",
"Crafter Profile REST API documentation",
"",
"",
"GNU General Public License v3.0",
"http://www.gnu.org/licenses/gpl-3.0.txt"
);
return apiInfo;
}
}