Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cn19 opened this issue Apr 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@cn19
Copy link

cn19 commented Apr 3, 2023

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):
@cn19 cn19 added the bug Something isn't working label Apr 3, 2023
@shalousun shalousun changed the title tornaRest任务无法导入注释中的@response中内容 The tornaRest task is unable to import content from the @response in the comments. Apr 3, 2024
@shalousun
Copy link
Collaborator

The current response examples in torna are auto-generated by torna, and the data source is not from smart-doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants