-
Notifications
You must be signed in to change notification settings - Fork 280
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
Add HTTP style to the Request-example #588
base: master
Are you sure you want to change the base?
Conversation
麻烦说明下这个pr的目的是什么,什么场景需要。也提供下这个修改前后的一个文档效果对比图 |
提供一种 HTTP形式 Request-example ,和浏览器控制台调试网络请求格式一致,还有可以通过VSCode插件Rest-client调试接口
post form-data
upload file
get form-data
|
curl下的http 样例可以在restclient中直接使用吗? |
get form-data 可以用,其他的用不了 |
List<ApiParam> queryParams = apiMethodDoc.getQueryParams(); | ||
List<ApiParam> requestParams = apiMethodDoc.getRequestParams(); | ||
StringBuilder title = new StringBuilder().append("### ").append(apiMethodDoc.getDesc()).append("\n"); | ||
StringBuilder request = new StringBuilder().append(methodType).append(" ").append(apiMethodDoc.getUrl()).append(isGet ? " " : " HTTP/1.1").append("\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http/1.1这个硬编码是不是不太好,也存其它版本
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是参考Rest-client标准,有无对代码无影响。
/** | ||
* http flag | ||
*/ | ||
private boolean http; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个定义是不是语义不够精细。http代表配置http协议呢还是http样例呢,可以换个更详细的单词
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能否给建议个合适的单词?
@@ -742,16 +743,62 @@ else if (javaClass.isEnum()) { | |||
return ApiParamTreeUtil.buildMethodReqParam(paramList, queryReqParamMap, pathReqParamMap, requestBodyCounter); | |||
} | |||
|
|||
default ApiRequestExample buildReqJson(DocJavaMethod javaMethod, ApiMethodDoc apiMethodDoc, String methodType, | |||
ProjectDocConfigBuilder configBuilder, FrameworkAnnotations frameworkAnnotations) { | |||
default String buildHttpJson(DocJavaMethod docJavaMethod, ApiMethodDoc apiMethodDoc, String methodType, ProjectDocConfigBuilder projectBuilder, FrameworkAnnotations frameworkAnnotations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下面这新增的内容是不是在html的文档格式下不起作用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
html的文档格式下指什么功能及作用
有用 |
# Conflicts: # pom.xml # src/test/java/com/ly/doc/ApiDocTest.java
添加HTTP样式Request-example