Merge pull request #113 from iisimpler/fix_issue_20210429

fix issue with inlineEnum & url not splice '?' when param is null'
This commit is contained in:
shalousun 2021-05-11 22:40:51 +08:00 committed by GitHub
commit 768d522a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -489,7 +489,7 @@ public class ParamsBuildHelper {
}
String enumComments = javaClass.getComment();
if (projectBuilder.getApiConfig().getInlineEnum()) {
ApiDataDictionary dataDictionary = projectBuilder.getApiConfig().getDataDictionary(javaClass.getSimpleName());
ApiDataDictionary dataDictionary = projectBuilder.getApiConfig().getDataDictionary(javaClass.getCanonicalName());
if (Objects.isNull(dataDictionary)) {
comment = comment + "<br/>" + JavaClassUtil.getEnumParams(javaClass);
} else {

View File

@ -527,12 +527,12 @@ public class ApiConfig {
this.dataDictionaries = CollectionUtil.asList(dataDictConfigs);
}
public ApiDataDictionary getDataDictionary(String enumClassSimpleName) {
public ApiDataDictionary getDataDictionary(String enumClassName) {
if (Objects.isNull(this.dataDictionaries)) {
return null;
}
return this.dataDictionaries.stream().filter((apiDataDictionary ->
enumClassSimpleName.equalsIgnoreCase(apiDataDictionary.getEnumClassName())))
enumClassName.equalsIgnoreCase(apiDataDictionary.getEnumClassName())))
.findFirst().orElse(new ApiDataDictionary());
}

View File

@ -466,7 +466,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
url = UrlUtil.simplifyUrl(url);
if (requestExample.isJson()) {
if (StringUtil.isNotEmpty(requestExample.getJsonBody())) {
if (StringUtil.isNotEmpty(body)) {
url = url + "?" + body;
}
CurlRequest curlRequest = CurlRequest.builder()