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

com.xfvape.swagger.spring.boot.autoconfigure.Swagger2Facade Maven / Gradle / Ivy

The newest version!
package com.xfvape.swagger.spring.boot.autoconfigure;

import com.google.common.base.Optional;

import io.swagger.models.Swagger;
import springfox.documentation.service.Documentation;
import springfox.documentation.spring.web.DocumentationCache;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.mappers.ServiceModelToSwagger2Mapper;

public class Swagger2Facade {
	
	private DocumentationCache documentationCache;

	private ServiceModelToSwagger2Mapper mapper;
	
	

	public Swagger2Facade(DocumentationCache documentationCache, ServiceModelToSwagger2Mapper mapper) {
		super();
		this.documentationCache = documentationCache;
		this.mapper = mapper;
	}



	public Swagger getDocumentation(String swaggerGroup) {
		String groupName = Optional.fromNullable(swaggerGroup).or(Docket.DEFAULT_GROUP_NAME);
		Documentation documentation = documentationCache.documentationByGroup(groupName);
		if (documentation == null) {
			return null;
		}
		return mapper.mapDocumentation(documentation);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy