|
@ -1,5 +1,11 @@
|
|
|
package com.yihu.wlyy.config;
|
|
|
|
|
|
import io.github.swagger2markup.GroupBy;
|
|
|
import io.github.swagger2markup.Language;
|
|
|
import io.github.swagger2markup.Swagger2MarkupConfig;
|
|
|
import io.github.swagger2markup.Swagger2MarkupConverter;
|
|
|
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
|
|
|
import io.github.swagger2markup.markup.builder.MarkupLanguage;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.web.context.request.async.DeferredResult;
|
|
@ -12,6 +18,9 @@ import springfox.documentation.spi.DocumentationType;
|
|
|
import springfox.documentation.spring.web.plugins.Docket;
|
|
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
|
|
|
|
import java.net.URL;
|
|
|
import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@ -201,4 +210,40 @@ public class SwaggerConfig {
|
|
|
|
|
|
return apiInfo;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 生成html文章专用
|
|
|
*
|
|
|
private static final String Doctor_API = "doctor";
|
|
|
private static final String Patient_API = "patient";
|
|
|
private static final String Other_API = "other";
|
|
|
private static final String GateWay_API = "gateway";
|
|
|
* @param args
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
String groupName="doctor";
|
|
|
//String groupName="patient";
|
|
|
//String groupName="other";
|
|
|
// String groupName="gateway";
|
|
|
|
|
|
URL remoteSwaggerFile = new URL("http://127.0.0.1:8080//v2/api-docs?group="+groupName);
|
|
|
Path outputFile = Paths.get("patient-co/patient-co-wlyy/build/"+groupName);
|
|
|
|
|
|
Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
|
|
|
.withMarkupLanguage(MarkupLanguage.ASCIIDOC)
|
|
|
.withOutputLanguage(Language.ZH)
|
|
|
.withPathsGroupedBy(GroupBy.TAGS)
|
|
|
.withGeneratedExamples()
|
|
|
.withoutInlineSchema()
|
|
|
.withBasePathPrefix()
|
|
|
.build();
|
|
|
|
|
|
Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
|
|
|
.withConfig(config)
|
|
|
.build();
|
|
|
|
|
|
converter.toFile(outputFile);
|
|
|
}
|
|
|
}
|