Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Commit dd572f8

Browse files
jasonkung22linwumingshi
authored andcommitted
fix: Fix issue If the request parameter contains type "date" and the parameter name is endTime or beginTime, the resulting example value may be different from what you expect.
1 parent 5359635 commit dd572f8

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/com/ly/doc/helper/ParamsBuildHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ private static List<ApiParam> processFields(String className, String pre, int le
348348
// Analyzing Primitive Type Field
349349
if (JavaClassValidateUtil.isPrimitive(subTypeName)) {
350350
if (StringUtil.isEmpty(fieldValue)) {
351-
fieldValue = StringUtil.isNotEmpty(fieldJsonFormatValue) ? fieldJsonFormatValue
352-
: StringUtil.removeQuotes(DocUtil.getValByTypeAndFieldName(subTypeName, field.getName()));
351+
fieldValue = StringUtil.isNotEmpty(fieldJsonFormatValue) ? fieldJsonFormatValue : StringUtil
352+
.removeQuotes(DocUtil.getValByTypeAndFieldName(typeSimpleName, field.getName()));
353353
}
354354

355355
ApiParam param = ApiParam.of()

src/main/java/com/ly/doc/utils/DocUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ private DocUtil() {
168168
FIELD_VALUE.put("message-string", "success,fail".split(",")[RandomUtil.randomInt(0, 1)]);
169169
FIELD_VALUE.put("date-string", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
170170
FIELD_VALUE.put("date-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
171-
FIELD_VALUE.put("begintime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
172-
FIELD_VALUE.put("endtime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_DAY));
171+
FIELD_VALUE.put("begintime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_SECOND));
172+
FIELD_VALUE.put("endtime-date", DateTimeUtil.dateToStr(new Date(), DateTimeUtil.DATE_FORMAT_SECOND));
173173
FIELD_VALUE.put("time-localtime",
174174
LocalDateTime.now().toLocalTime().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
175175
FIELD_VALUE.put("state-int", String.valueOf(RandomUtil.randomInt(0, 10)));

0 commit comments

Comments
 (0)