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

The tornaRest task is unable to import content from the @response in the comments. #11

@cn19

Description

@cn19

Expected Behavior(您期望的结果)

During the use of the plugin, for an API definition like the one below, the return value instance is defined using the @response tag.
使用插件过程中,对一个类似下面的接口定义,使用@response标签定义了返回值实例。

    /**
     * 数据版本
     *
     * @return 数据月份,如202301|com.common.Response<java.lang.String>
     * @response {
     *     "code": 0,
     *     "msg": "success!",
     *     "data": "1.0.0"
     * }
     */
    @GetMapping("month")
    public Response<String> dataVersion() {
        return null;
    }

The Response structure is relatively simple, with standard fields for status codes and descriptions.

@Data
public class Response<T> implements Serializable {
    private int code;
    private String msg;
    private T data;
}

The documents generated by the smartDocOpenApi and smartDocMarkdown tasks meet expectations, using examples from the comments.
使用smartDocOpenApi、smartDocMarkdown任务生成的文档符合预期,使用了注释中的示例

{
              "examples": {
                  "json": {
                    "summary": "test data",
                    "value": "{\n  \"code\": 0,\n  \"msg\": \"success!\",\n  \"data\": \"202301\"\n}"
                  }
                }
}

Executing the torna task, the expected imported document should also use examples from the comments, but in reality, it generates random return value examples.
执行torna任务,预期导入的文档也应当使用注释中的示例,但是实际生成了随机的返回值示例。

Current Behavior(当前结果)

When executing the torna task, random return values were generated without using the examples in the comments.
实际执行torna任务时,生成了随机的返回值,没有使用注释中的示例。
image

Possible Solution(bug解决建议)

Steps to Reproduce (Bug产生步骤,请尽量提供用例代码)

Context(Bug影响描述)

Your Environment(您的使用环境)

  • smart-doc version:
  • plugin version (e.g. smart-doc-maven-plugin or smart-doc-gradle-plugin):
  • build tool version(maven or gradle):

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions