Git Product home page Git Product logo

tongchengopensource / smart-doc Goto Github PK

View Code? Open in Web Editor NEW
1.4K 26.0 272.0 32.53 MB

Smart-doc is a java restful api document generation tool. Smart-doc is based on interface source code analysis to generate interface documentation, completely zero-injection.

Home Page: https://smart-doc-group.github.io/#/

License: Apache License 2.0

Java 88.55% HTML 9.76% CSS 0.41% JavaScript 1.25% Makefile 0.02%

smart-doc's Introduction

Smart-Doc Project

maven License number of issues closed closed pull requests java version chinese gitee star git star

Introduce

smart-doc[smɑːt dɒk]is a tool that supports both JAVA REST API and JAVA WebSocket and Apache Dubbo RPC interface document generation. Smart-doc is based on interface source code analysis to generate interface documents, and zero annotation intrusion. You only need to write Javadoc comments when developing, smart-doc can help you generate Markdown or HTML5 document. smart-doc does not need to inject annotations into the code like Swagger.

quick start

Documentation

Features

  • Zero annotation, zero learning cost, only need to write standard JAVA document comments.
  • Automatic derivation based on source code interface definition, powerful return structure derivation support.
  • Support Spring MVC, Spring Boot, Spring Boot Web Flux (Not support endpoint), Feign,JAX-RS.
  • Supports the derivation of asynchronous interface returns such as Callable, Future, CompletableFuture.
  • Support JSR-303parameter verification specification.
  • Support for automatic generation of request examples based on request parameters.
  • Support for generating JSON return value examples.
  • Support for loading source code from outside the project to generate field comments (including the sources jar package).
  • Support for generating multiple formats of documents: Markdown,HTML5,Word,Asciidoctor,Postman Collection 2.0+,OpenAPI 3.0.
  • Support the generation of Jmeter performance testing scripts
  • Support for generating Javadoc documentation for Java classes.
  • Support for exporting error codes and data dictionary codes to API documentation.
  • The debug html5 page fully supports file upload and download testing.
  • Support Apache Dubbo RPC.

Best Practice

smart-doc + Torna form an industry-leading document generation and management solution, using smart-doc to complete Java source code analysis and extract annotations to generate API documents without intrusion, and automatically push the documents to the Torna enterprise-level interface document management platform.

smart-doc+torna

Building

You could build with the following commands. (JDK 1.8 is required to build the master branch)

mvn clean install -Dmaven.test.skip=true

TODO

  • GRPC

Who is using

These are only part of the companies using smart-doc, for reference only. If you are using smart-doc, please add your company here to tell us your scenario to make smart-doc better.

IFLYTEK                                                    

Acknowledgements

Thanks to JetBrains SoftWare for providing free Open Source license for this project.

License

Smart-doc is under the Apache 2.0 license. See the LICENSE file for details.

Contact

Email: [email protected]

smart-doc's People

Contributors

2hexigua avatar baboy avatar bugdesigner1 avatar chenqi146 avatar dai19470 avatar daisy-yangyang avatar delei avatar fioooooooo avatar gujinicy avatar hans-wu-cn avatar hwck avatar iisimpler avatar jingxiang avatar jtepromise avatar kasmax6 avatar leeyazhou avatar linwumingshi avatar luchuanbaker avatar netdied avatar noear avatar selfly avatar shalousun avatar sunyan1236 avatar tianmingxing avatar tianya66 avatar vector-plus avatar younker99 avatar zhreimu avatar zoze0 avatar zuonidelaowang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smart-doc's Issues

Since version 2.7.7, Dubbo has changed the `@Service` annotation to `@DubboService`.

Summary

  1. Suggestion
    Change the definition of Dubbo annotations from SERVICE to an array to accommodate both @service and @DubboService tags.

  2. Discussion
    For Dubbo services exposed only through configuration files, such as the following:

  <bean id="demoService" class="com.demo.provider.DemoServiceImpl" /> 
  <dubbo:service interface="com.demo.provider.Provider" ref="demoService" />

Could scanning the configuration file also resolve this?

Basic example

If the proposal involves a new or changed API, include a basic code example. Omit this section if it's not applicable.

Motivation

Why are we doing this? What use cases does it support? What is the expected outcome?

Postman GET request parameter generation.

I noticed you fixed the bug I previously reported about generating GET parameters in Postman. After downloading the dev branch, I tested it. The interface cannot support file upload types.
看你们修复了我之前提的postman生成get参数的bug
我下载了dev分支后 测试了
接口中存在文件上传类型无法支持

@GetMapping(value = "/test")
public void test(@RequestParam MultipartFile file ,@RequestParam String aaa)

@PostMapping(value = "/test")
public void test(@RequestParam MultipartFile file ,@RequestParam String aaa)

Version 1.8.6 still has the issue of array index out of bounds.

smart-doc 1.8.6
smart-doc-maven-plugin 1.0.7

[ERROR] java.lang.ArrayIndexOutOfBoundsException: 1 at com.power.doc.utils.DocClassUtil.classNameFix (DocClassUtil.java:122) at com.power.doc.utils.DocClassUtil.getSimpleGicName (DocClassUtil.java:58) at com.power.doc.helper.JsonBuildHelper.buildJson (JsonBuildHelper.java:99) at com.power.doc.helper.JsonBuildHelper.buildReturnJson (JsonBuildHelper.java:63) at com.power.doc.template.SpringBootDocBuildTemplate.buildControllerMethod (SpringBootDocBuildTemplate.java:170) at com.power.doc.template.SpringBootDocBuildTemplate.getApiData (SpringBootDocBuildTemplate.java:81) at com.power.doc.builder.HtmlApiDocBuilder.buildApiDoc (HtmlApiDocBuilder.java:78) at com.smartdoc.mojo.HtmlMojo.executeMojo (HtmlMojo.java:47) at com.smartdoc.mojo.BaseDocsGeneratorMojo.execute (BaseDocsGeneratorMojo.java:120) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

Is it possible to support Front-matter?

Typically, MD files have Front-matter metadata like title, tags, categories, etc. Could these be configured by adding annotations to the class?
一般md文件会增加一些Front-matter元数据
如title 、tags、categories等,能否通过在类上增加注解的方式配置上这些信息
image

Throw an exception when the return type of the generic T is a byte array.

When generating Dubbo interface documentation with mvn smart-doc:rpc-html, encountering such a method will throw an exception.
mvn smart-doc:rpc-html生成dubbo接口文档时,遇到这样的方法会抛出异常:
SomeResponse<byte[]> someMethod(String somParam);

Expected Behavior(您期望的结果)

It can be parsed normally.
能正常解析。

Current Behavior(当前结果)

RpcDocBuildTemplate.methodDefinition throw exception:
java.util.regex.PatternSyntaxException: Unclosed character class near index 5
byte[]

Possible Solution(bug解决建议)

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

Context(Bug影响描述)

Your Environment(您的使用环境)

smart-doc 1.9.0
jdk 1.8

I've used ModelAndView globally in my project. Is it possible to skip this without encountering an error during generation?

Hello, I've used ModelAndView globally in my project. Is it possible to skip this during generation without causing an error? Because this class is needed, but every time an interface is generated, this method has to be deregistered, which is a bit troublesome.
您好,我在项目中全局使用了ModelAndView,能否在生成的时候遇到这个就跳过,不报错呢,因为这个类是需要使用的,但是每次生成接口的时候,都要把这个方法注销,有点麻烦

Who is using smart-doc

Feeling concerned about smart-doc users, we will strive to do a good job of smart-doc to provide developers with a useful Api document generation tool.

Purpose of this issue

  • Collect users who use smart-doc in the project.

  • Collect suggestions from more users.

  • Learn from more developers to contribute.

We look forward to hearing from you

  • Your company, school or organization

  • Logo of your company, school or organization (hope you provide a logo, we will show this logo on the official website)

When the return value object uses Void (java.lang.Void), it will result in an infinite loop.

When the interface's return value or parameters, property references are self-referential, it will lead to an infinite loop and ultimately cause a memory overflow.
`java.lang.OutOfMemoryError: Java heap space

at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at com.power.doc.builder.SourceBuilder.buildJson(SourceBuilder.java:966)
at com.power.doc.builder.SourceBuilder.buildJson(SourceBuilder.java:966)
at com.power.doc.builder.SourceBuilder.buildJson(SourceBuilder.java:966)
at com.power.doc.builder.SourceBuilder.buildJson(SourceBuilder.java:966)`

The controller's return value has been rewritten using RestControllerAdvice. How can the interface documentation output the revised return value?

For example, the controller's return value is a String, but after rewriting, it becomes a custom class ReturnStatusObj. The final return is ReturnStatusObj, but the interface documentation outputs a String. How can this be achieved?
比如controller返回值是String,改写后的是自定义类ReturnStatusObj.
最终返回的是ReturnStatusObj,但接口文档中输出的是String.
请问通过什么方式可以实现?

@RestControllerAdvice(basePackages = {"com.xbsj.database.controller"})
public class ControllerResultInterceptor implements ResponseBodyAdvice {

@Override
public boolean supports(MethodParameter methodParameter, Class aClass) {
    //这里直接返回true,表示对任何handler的responsebody都调用beforeBodyWrite方法
    return true;
}

@Override
public Object beforeBodyWrite(Object resBody, MethodParameter methodParameter, MediaType mediaType, Class aClass, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {

    ReturnStatusObj statusObj = new ReturnStatusObj(resBody);
    if(resBody instanceof String)
        return JSONObject.toJSONString(statusObj, SerializerFeature.WriteMapNullValue);

    return statusObj;
}

}

[feature request] The JavaScript used in the HTML documentation should be implemented natively.

Summary (Description of this PR)

The JavaScript in the HTML documentation is implemented natively.

Motivation (Purpose of this PR)

Sometimes development must occur on an intranet, where the documentation cannot be accessed from the external network, preventing the download of jQuery and web fonts.
The main impact is that the collapsible function of the left-side interface menu is lost.

Does it support Vert.x?

Planning to use Vert.x, just looking for an API documentation tool, does it support that?
打算使用 Vert.x,刚好想寻找接口文档工具,请问支持吗?

Sent from PPHub

Ignoring the entire entity using @ignore is inconvenient.

Summary (Description of this PR)

For the request parameters, I want to ignore the WebSecurityContextService class. This class contains many attributes of other objects, and using @ignore is very inconvenient as there are too many classes to modify. Is there any method to resolve this?

Basic Example (Use Case for the PR)

@PostMapping("delete")
public ResultObject deleteConfigMap(
    @RequestParam String configMapName,
    WebSecurityContextService securityContextService
) {}

Enumeration support is not good.

URL: http://192.168.31.100:9011/a/customer/info/audit/{action}
Type: POST

Content-Type: application/json; charset=utf-8

Description:

Request-headers:

Parameter Type Description Required Since
action string No comments found. true -
id int64 主键ID false -
comment string No comments found. false -
action string No comments found. false -

The action here is an enumeration type, but it is displayed as a string, which confuses the users.
我这里的action是一个枚举类型,但是生成出来显示为string,让使用者摸不着头脑。

The postman.json file generated by smart-doc causes an error when imported into yapi.

The attachment is the generated postman file.
未命名1591410903
{ "info": { "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", "_postman_id": "668e04ad-2b3f-4b94-b0d3-e0d1d471f693", "name": "smart-doc 2020-06-06 10:26:18" }, "item": [ { "name": "用户管理控制器", "item": [ { "name": "分页查询用户信息", "request": { "method": "GET", "body": { "mode": "formdata", "formdata": [ { "key": "pageNum", "type": "text", "desc": "当前页", "value": "1" }, { "key": "pageSize", "type": "text", "desc": "每页大小", "value": "10" } ] }, "url": "http://10.1.130.107:8888/user/list/tt19nd?pageNum\u003d1\u0026pageSize\u003d10", "description": "分页查询用户信息", "header": [] }, "description": "分页查询用户信息" } ] } ] }

Can the document title be modified?

image
image

Hello, I'd like to know how to set a title alias for this tool. Sometimes I want to set the title in Chinese and add a new column display. For example:

Parameter Type Description Required Since
Field Type Description Since

Parameter Name Type Description Required Field Length Version Parent Node
Field Name Type Description ........

Is it possible to support customizing the display content?

The current documentation shows the following content.
URL: http://XXX
Type: GET
Content-Type: application/x-www-form-urlencoded;charset=utf-8
Description: XXXXX
.......

We want to display the interface developer's name, "author", in the documentation. Can we customize the display content to meet the different needs of each company?

Thank you.

In the HTML report, only the first directory in the left list displays a second-level directory.

Summary

In the HTML report, only the first directory in the left list displays a second-level directory. After reviewing the allinone.css file, it seems that by default, the second-level directories are set to not be displayed (display: none).

Suggestions:

  1. It would be ideal if the left list could have a feature for collapsing and expanding directories. This way, users can choose when to display the second-level directories and when to hide them.
  2. If implementing a collapsible feature is difficult, consider changing the default CSS for sectorlevel2 to display: block, so that all second-level directories are visible by default. Alternatively, provide an option for users to decide whether to expand all directories or not.

Basic example

Motivation

[feature request] Embed CSS using the <style></style> method to generate a single HTML file.

Summary (Description of this PR)

Add a configuration option to allow the HTML AllInOne'mode documentation to embed CSS using the <style></style> method.

Basic Example (Use Case for the PR)

If the proposal involves a new or changed API, include a basic code example. Omit this section if it's not applicable.

Motivation (Purpose of this PR)

Currently, in HTML AllInOne mode, HTML and CSS are separate and CSS is linked via an external file. This requires packaging into a single file for offline transmission.
Could we add a configuration to generate CSS embedded within the HTML, achieving a true ALL IN ONE?

The nested object collection in the return result has not been parsed.

Expected Behavior(您期望的结果)

Display the properties of objects in nested collections in the documentation.

Current Behavior(当前结果)

Nested objects are displayed, but the generics of collection objects (List<>) are not shown.

Possible Solution(bug解决建议)

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

The object structure is as follows:
R is a unified return object, with ProductOrderVo placed inside the data attribute of R. However, the productList attribute within ProductOrderVo cannot be parsed.

public class R<T> implements Serializable {
  private String code = ResultCode.SUCCESS.getCode();
  private String msg = "success";
  private T data;
}
public class ProductOrderVo implements Serializable {
  private List<ProductAppOrderRelVo> productList;
}
public class ProductAppOrderRelVo implements Serializable {
  private String productName;
  private List<AppOrderAddedVo> addedList;
  private String userName;
}

Context(Bug影响描述)

Your Environment(您的使用环境)

  • smart-doc version: 1.8.8
    Using the method of generating documentation with a test class. The code is as follows:
@SpringBootTest
public class SmartDocTests {
  @Test
  public void testBuilderControllersApi() {
    ApiConfig config = new ApiConfig();
    config.setDataDictionaries(null);
    // 以前的版本为setSourcePaths,SourceCodePath为SourcePath
    config.setSourceCodePaths(
        SourceCodePath.path().setDesc("本项目代码").setPath(DocGlobalConstants.PROJECT_CODE_PATH)
        ,
        SourceCodePath.path()
            .setDesc("加载外部项目源码")
            .setPath(
                "D:\\xxx\\xxx\\xxx\\"
                    + DocGlobalConstants.PROJECT_CODE_PATH));
    config.setServerUrl("http://ip:port/context");

    config.setAllInOne(true);

    config.setOutPath("d:\\test\\md");
    ApiDocBuilder.buildApiDoc(config);
  }
}

Executing the maven plugin results in an error.

// Generate Postman JSON data.
mvn -Dfile.encoding=UTF-8 smart-doc:postman
`
java.lang.ArrayIndexOutOfBoundsException: 1
at com.power.doc.utils.DocClassUtil.classNameFix (DocClassUtil.java:122)
at com.power.doc.utils.DocClassUtil.getSimpleGicName (DocClassUtil.java:58)
at com.power.doc.helper.JsonBuildHelper.buildJson (JsonBuildHelper.java:99)
at com.power.doc.helper.JsonBuildHelper.buildReturnJson (JsonBuildHelper.java:63)
at com.power.doc.template.SpringBootDocBuildTemplate.buildControllerMethod (SpringBootDocBuildTemplate.java:170)
at com.power.doc.template.SpringBootDocBuildTemplate.getApiData (SpringBootDocBuildTemplate.java:81)
at com.power.doc.builder.HtmlApiDocBuilder.buildApiDoc (HtmlApiDocBuilder.java:78)
at com.smartdoc.mojo.HtmlMojo.executeMojo (HtmlMojo.java:47)
at com.smartdoc.mojo.BaseDocsGeneratorMojo.execute (BaseDocsGeneratorMojo.java:122)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:355)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO]
[INFO] <<< smart-doc-maven-plugin:1.0.6:postman (default-cli) < compile @ sentinel-dashboard <<<
[INFO]
[INFO]
[INFO] --- smart-doc-maven-plugin:1.0.6:postman (default-cli) @ sentinel-dashboard ---
[INFO] Smart-doc Starting Create API Documentation.
[INFO] API Documentation output to D://md2
[ERROR]

`

Multiple generics are not supported.

When generating documentation for a structure like TestBean<Bean1, Bean2>, Bean2 is not correctly generated and will use the content of Bean1 instead.
TestBean<Bean1, Bean2> 这种的结构生成文档时,Bean2无法正确生成,会用Bean1的内容。

Does it support spring-data-rest?

Spring Data REST is built on top of Spring Data repositories and automatically exposes them as REST resources. It utilizes hypermedia to allow clients to discover the functionality exposed by repositories and integrates these resources into related hypermedia actions.

As it seems, currently only paths under controllers are supported, while the interfaces automatically generated by data-rest cannot be added to the API documentation, right?
Spring Data REST构建在Spring Data repositories之上,并自动将其导出为REST资源。它利用超媒体来允许客户端查找存储库暴露的功能,并将这些资源自动集成到相关的超媒体功能中。

现在貌似只支持controller下的路径,而data-rest自动生成的接口似乎是没法加入到api文档中的?

Support for Chinese needs to be strengthened.

When the design language is set to Chinese, there are still many Chinese characters on the generated page. Is there a plan for translation?
设计语言为中文时, 生成的页面上, 还是有很多中文, 有翻译的计划吗?
image

Unable to properly resolve nested generics

Expected Behavior(您期望的结果)

When parsing the following RPC method:
解析下面的rpc方法时:

SomeResp<PageInfo<SomeVO>>  someFunction(SomeReq req);·

Where PageInfo is the pagination wrapper class of pageHelper, and SomeVO is a VO object as shown below,
其中PageInfo是pageHelper的分页包装类,SomeVO是如下所示VO对象,

public class SomeVO {
    String name;
    Integer age;
    BigDecimal amt;
}

SomeResp is a generic class as shown below:
SomeResp是如下所示的泛型类:

public class SomeResp<T> {
     T result;
}

The expected analysis result is to list the members of SomeVO in the response list, without listing the members of PageInfo (providing a mechanism to specify types that are not expanded).
期望分析结果是在响应列表列出的SomeVO的成员,
不列出PageInfo成员(提供一种指定类型不展开的机制)。

Current Behavior(当前结果)

  1. The interface definition for generating documentation with smart-doc is:
Definition:  SomeResp<SomeVO>>  someFunction(SomeReq req);  // It's missing the "PageInfo<"
  1. The "Response-fields" list has displayed result layer by layer, but it only shows the members of the PageInfo class, without involving SomeVO at all.
    Below is the uploaded image, for well-known reasons, it might need to be accessed from outside the country to display properly.

image

Possible Solution(bug解决建议)

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

Context(Bug影响描述)

Your Environment(您的使用环境)

smart-doc-maven-plugin 1.1.2

Generate Postman request parameters.

For POST method interfaces, generating request parameters is complete. However, why aren't request parameters generated for GET methods? This results in having to fill them in manually every time. Can support for generating request parameters for GET methods be added? When importing into Postman, can it intelligently merge instead of forcefully overwriting? It's possible that the required request parameters have been set.
对post方式的接口生成请求参数完整
但是对get方式为什么不生成请求参数了 导致每次都需要自己填
可以支持下get方式的请求参数生成么
导入postman能否智能合并 别强行覆盖了 可能设置过需要的请求参数了

The 1.7.8 version has a bug.

The documentation generation for the interface was normal through version 1.7.7, but there are issues after upgrading to the latest version.
通过1.7.7版本对接口生成文档是正常的,但是升级到最新版本就有问题了
TIM图片20191209155714

It is suggested to support user-defined RPC interface annotations.

Summary

It is recommended that the RPC interface documentation generation supports user-defined interface annotations to facilitate the creation of users' own RPC interface documentation.
建议生成rpc接口文档支持用户自定义的接口注解,以支持生成用户自己的rpc接口文档。

Basic example

  1. User-defined RPC interface annotations
public @interface MyService {
...
}
  1. Interface class using custom RPC interface annotations:
@MyService  
public interface MyInterface {
...
}
  1. Generate interface documentation for custom RPC interface annotations:
mvn smart-doc:rpc-html  -Drpc.annotations="com.xxx.MyService,com.xxx.YourService" // Support for multiple custom annotations separated by commas

Motivation

Extend the adaptability of smart-doc to more scenarios.
扩展smart-doc的适应场景

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.