fix #I26JRA .

This commit is contained in:
oppofind 2020-11-23 21:02:41 +08:00
parent 6329f64482
commit ff2c716e5e
6 changed files with 103 additions and 95 deletions

View File

@ -1,5 +1,10 @@
## smart-doc版本
版本小于1.0都属于试用正式1.0起始发布将会等到文中提到的问题解决后才发布。
#### 版本号1.9.9.1
- 更新日期: 2020-11-23
- 更新内容:
1. 这是一个紧急修改版本。
2. 解决1.9.9版本controller中存在非路径映射方法时的错误。
#### 版本号1.9.9
- 更新日期: 2020-11-23
- 更新内容:

View File

@ -93,7 +93,7 @@ smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc
"coverOld": true, //是否覆盖旧的文件主要用于mardown文件覆盖
"packageFilters": "",//controller包过滤多个包用英文逗号隔开
"md5EncryptedHtmlName": false,//只有每个controller生成一个html文件是才使用
"style":"xt256", //基于highlight.js的代码高设置,喜欢配色统一简洁的同学可以不设置
"style":"xt256", //基于highlight.js的代码高设置,可选值很多可查看码云wiki,喜欢配色统一简洁的同学可以不设置
"projectName": "smart-doc",//配置自己的项目名称
"skipTransientField": true,//目前未实现
"sortByTitle":false,//接口标题排序默认为false,@since 1.8.7版本开始

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>smart-doc</artifactId>
<packaging>jar</packaging>
<version>1.9.9</version>
<version>1.9.9.1</version>
<name>smart-doc</name>
<url>https://github.com/smart-doc-group/smart-doc.git</url>

View File

@ -18,7 +18,7 @@ public class HighlightStyle {
/**
* key is style,value is color
*/
private static final Map<String,String> background = new HashMap<>();
private static final Map<String, String> background = new HashMap<>();
static {
LIGHT_STYLE = Arrays.asList(
@ -125,92 +125,92 @@ public class HighlightStyle {
}
static {
background.put("a11y-dark","#2b2b2b");
background.put("agate","#333");
background.put("androidstudio","#282b2e");
background.put("atom-one-light","#fafafa");
background.put("an-old-hope","#1c1d21");
background.put("arta","#222");
background.put("atelier-cave-dark","#19171c");
background.put("atelier-cave-light","#efecf4");
background.put("atelier-dune-dark","#20201d");
background.put("atelier-dune-light","#fefbec");
background.put("atelier-estuary-dark","#22221b");
background.put("atelier-estuary-light","#f4f3ec");
background.put("atelier-forest-dark","#1b1918");
background.put("atelier-forest-light","#f1efee");
background.put("atelier-heath-dark","#1b181b");
background.put("atelier-heath-light","#f7f3f7");
background.put("atelier-lakeside-dark","#161b1d");
background.put("atelier-lakeside-light","#ebf8ff");
background.put("atelier-plateau-dark","#1b1818");
background.put("atelier-plateau-light","#f4ecec");
background.put("atelier-savanna-dark","#171c19");
background.put("atelier-savanna-light","#ecf4ee");
background.put("atelier-seaside-dark","#131513");
background.put("atelier-seaside-light","#f4fbf4");
background.put("atelier-cave-light","#efecf4");
background.put("atelier-sulphurpool-dark","#202746");
background.put("atelier-sulphurpool-light","#f5f7ff");
background.put("atom-one-dark","#282c34");
background.put("atom-one-dark-reasonable","#282c34");
background.put("codepen-embed","#222");
background.put("darcula","#2b2b2b");
background.put("dark","#444");
background.put("default","#F0F0F0");
background.put("docco","#f8f8ff");
background.put("dracula","#282a36");
background.put("far","#000080");
background.put("foundation","#eee");
background.put("github","#f8f8f8");
background.put("gml","#222222");
background.put("gradient-dark","linear-gradient(166deg, rgba(80,31,122,1) 0%, rgba(40,32,179,1) 80%)");
background.put("gruvbox-dark","#282828");
background.put("gruvbox-light","#fbf1c7");
background.put("hopscotch","#322931");
background.put("hybrid","#1d1f21");
background.put("ir-black","#000");
background.put("isbl-editor-dark","#404040");
background.put("kimbie.dark","#221a0f");
background.put("kimbie.light","#fbebd4");
background.put("lioshi","#303030");
background.put("magula","#f4f4f4");
background.put("mono-blue","#eaeef3");
background.put("monokai","#272822");
background.put("monokai-sublime","#23241f");
background.put("night-owl","#011627");
background.put("nnfx-dark","#333");
background.put("nord","#2E3440");
background.put("obsidian","#282b2e");
background.put("ocean","#2b303b");
background.put("paraiso-dark","#2f1e2e");
background.put("paraiso-light","#e7e9db");
background.put("purebasic","#FFFFDF");
background.put("qtcreator_dark","#000000");
background.put("railscasts","#232323");
background.put("rainbow","#474949");
background.put("routeros","#f0f0f0");
background.put("a11y-dark", "#2b2b2b");
background.put("agate", "#333");
background.put("androidstudio", "#282b2e");
background.put("atom-one-light", "#fafafa");
background.put("an-old-hope", "#1c1d21");
background.put("arta", "#222");
background.put("atelier-cave-dark", "#19171c");
background.put("atelier-cave-light", "#efecf4");
background.put("atelier-dune-dark", "#20201d");
background.put("atelier-dune-light", "#fefbec");
background.put("atelier-estuary-dark", "#22221b");
background.put("atelier-estuary-light", "#f4f3ec");
background.put("atelier-forest-dark", "#1b1918");
background.put("atelier-forest-light", "#f1efee");
background.put("atelier-heath-dark", "#1b181b");
background.put("atelier-heath-light", "#f7f3f7");
background.put("atelier-lakeside-dark", "#161b1d");
background.put("atelier-lakeside-light", "#ebf8ff");
background.put("atelier-plateau-dark", "#1b1818");
background.put("atelier-plateau-light", "#f4ecec");
background.put("atelier-savanna-dark", "#171c19");
background.put("atelier-savanna-light", "#ecf4ee");
background.put("atelier-seaside-dark", "#131513");
background.put("atelier-seaside-light", "#f4fbf4");
background.put("atelier-cave-light", "#efecf4");
background.put("atelier-sulphurpool-dark", "#202746");
background.put("atelier-sulphurpool-light", "#f5f7ff");
background.put("atom-one-dark", "#282c34");
background.put("atom-one-dark-reasonable", "#282c34");
background.put("codepen-embed", "#222");
background.put("darcula", "#2b2b2b");
background.put("dark", "#444");
background.put("default", "#F0F0F0");
background.put("docco", "#f8f8ff");
background.put("dracula", "#282a36");
background.put("far", "#000080");
background.put("foundation", "#eee");
background.put("github", "#f8f8f8");
background.put("gml", "#222222");
background.put("gradient-dark", "linear-gradient(166deg, rgba(80,31,122,1) 0%, rgba(40,32,179,1) 80%)");
background.put("gruvbox-dark", "#282828");
background.put("gruvbox-light", "#fbf1c7");
background.put("hopscotch", "#322931");
background.put("hybrid", "#1d1f21");
background.put("ir-black", "#000");
background.put("isbl-editor-dark", "#404040");
background.put("kimbie.dark", "#221a0f");
background.put("kimbie.light", "#fbebd4");
background.put("lioshi", "#303030");
background.put("magula", "#f4f4f4");
background.put("mono-blue", "#eaeef3");
background.put("monokai", "#272822");
background.put("monokai-sublime", "#23241f");
background.put("night-owl", "#011627");
background.put("nnfx-dark", "#333");
background.put("nord", "#2E3440");
background.put("obsidian", "#282b2e");
background.put("ocean", "#2b303b");
background.put("paraiso-dark", "#2f1e2e");
background.put("paraiso-light", "#e7e9db");
background.put("purebasic", "#FFFFDF");
background.put("qtcreator_dark", "#000000");
background.put("railscasts", "#232323");
background.put("rainbow", "#474949");
background.put("routeros", "#f0f0f0");
background.put("shades-of-purple","#2d2b57");
background.put("solarized-dark","#002b36");
background.put("solarized-light","#fdf6e3");
background.put("srcery","#1C1B19");
background.put("sunburst","#000");
background.put("tomorrow-night","#1d1f21");
background.put("tomorrow-night-blue","#002451");
background.put("tomorrow-night-bright","black");
background.put("tomorrow-night-eighties","#2d2d2d");
background.put("xt256","#000");
background.put("vs2015","#1E1E1E");
background.put("zenburn","#3f3f3f");
background.put("shades-of-purple", "#2d2b57");
background.put("solarized-dark", "#002b36");
background.put("solarized-light", "#fdf6e3");
background.put("srcery", "#1C1B19");
background.put("sunburst", "#000");
background.put("tomorrow-night", "#1d1f21");
background.put("tomorrow-night-blue", "#002451");
background.put("tomorrow-night-bright", "black");
background.put("tomorrow-night-eighties", "#2d2d2d");
background.put("xt256", "#000");
background.put("vs2015", "#1E1E1E");
background.put("zenburn", "#3f3f3f");
}
/**
* 随机一个 light style
*
* @param random
* @return
* @param random Random
* @return String of random
*/
public static String randomLight(Random random) {
return LIGHT_STYLE.get(random.nextInt(LIGHT_STYLE.size()));
@ -219,8 +219,8 @@ public class HighlightStyle {
/**
* 随机一个 dark style
*
* @param random
* @return
* @param random Random
* @return String of random
*/
public static String randomDark(Random random) {
return DARK_STYLE.get(random.nextInt(DARK_STYLE.size()));
@ -229,8 +229,8 @@ public class HighlightStyle {
/**
* 随机一个 style
*
* @param random
* @return
* @param random Random
* @return String of random
*/
public static String randomAll(Random random) {
if (random.nextBoolean()) {
@ -240,9 +240,9 @@ public class HighlightStyle {
}
}
public static String getBackgroundColor(String style){
public static String getBackgroundColor(String style) {
String color = background.get(style);
if(StringUtil.isNotEmpty(color)){
if (StringUtil.isNotEmpty(color)) {
return color;
}
return "#f7f7f8";

View File

@ -151,6 +151,12 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
if (StringUtil.isEmpty(method.getComment()) && apiConfig.isStrict()) {
throw new RuntimeException("Unable to find comment for method " + method.getName() + " in " + cls.getCanonicalName());
}
//handle request mapping
RequestMapping requestMapping = new SpringMVCRequestMappingHandler()
.handle(projectBuilder.getServerUrl(), baseUrl, method, constantsMap);
if (Objects.isNull(requestMapping)) {
continue;
}
methodOrder++;
ApiMethodDoc apiMethodDoc = new ApiMethodDoc();
apiMethodDoc.setName(method.getName());
@ -172,12 +178,6 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
apiMethodDoc.setAuthor(classAuthor);
}
apiMethodDoc.setDetail(apiNoteValue);
//handle request mapping
RequestMapping requestMapping = new SpringMVCRequestMappingHandler()
.handle(projectBuilder.getServerUrl(), baseUrl, method, constantsMap);
if (Objects.isNull(requestMapping)) {
continue;
}
//handle headers
List<ApiReqHeader> apiReqHeaders = new SpringMVCRequestHeaderHandler().handle(method);
@ -523,12 +523,14 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
paramName = paramName.replace(key, value);
}
}
AnnotationValue annotationRequired = annotation.getProperty(DocAnnotationConstants.REQUIRED_PROP);
if (null == annotationRequired) {
strRequired = "true";
}
}
if (JavaClassValidateUtil.isJSR303Required(annotationName)) {
strRequired = "true";
}
if (SpringMvcAnnotations.REQUEST_BODY.equals(annotationName)) {
if (requestBodyCounter > 0) {
throw new RuntimeException("You have use @RequestBody Passing multiple variables for method "

View File

@ -171,6 +171,7 @@ public class JavaClassValidateUtil {
case "NotEmpty":
case "NotBlank":
case "Required":
case "Size":
return true;
default:
return false;