Skip to content

Commit

Permalink
fix: Fix issue If the request parameter contains type "date" and the …
Browse files Browse the repository at this point in the history
…parameter name is endTime or beginTime, the resulting example value may be different from what you expect.
  • Loading branch information
jasonkung22 committed Nov 6, 2024
1 parent 5359635 commit 9d52106
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/ly/doc/helper/ParamsBuildHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ private static List<ApiParam> processFields(String className, String pre, int le
// Analyzing Primitive Type Field
if (JavaClassValidateUtil.isPrimitive(subTypeName)) {
if (StringUtil.isEmpty(fieldValue)) {
fieldValue = StringUtil.isNotEmpty(fieldJsonFormatValue) ? fieldJsonFormatValue
: StringUtil.removeQuotes(DocUtil.getValByTypeAndFieldName(subTypeName, field.getName()));
fieldValue = StringUtil.isNotEmpty(fieldJsonFormatValue) ? fieldJsonFormatValue : StringUtil
.removeQuotes(DocUtil.getValByTypeAndFieldName(typeSimpleName, field.getName()));
}

ApiParam param = ApiParam.of()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/ly/doc/utils/DocUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ private DocUtil() {
FIELD_VALUE.put("message-string", "success,fail".split(",")[RandomUtil.randomInt(0, 1)]);
FIELD_VALUE.put("date-string", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
FIELD_VALUE.put("date-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
FIELD_VALUE.put("begintime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
FIELD_VALUE.put("endtime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
FIELD_VALUE.put("begintime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_SECOND));
FIELD_VALUE.put("endtime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_SECOND));
FIELD_VALUE.put("time-localtime",
LocalDateTime.now().toLocalTime().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
FIELD_VALUE.put("state-int", String.valueOf(RandomUtil.randomInt(0, 10)));
Expand Down

0 comments on commit 9d52106

Please sign in to comment.