-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: thrift-gen-rpc-swagger plugin #4
feat: thrift-gen-rpc-swagger plugin #4
Conversation
return err | ||
} | ||
|
||
if req == nil { |
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.
这个判断应该在第一行, 不然可能引发panic
d.Info = &openapi.Info{ | ||
Title: "API generated by thrift-gen-rpc-swagger", | ||
Description: "API description", | ||
Version: "1.0.0", |
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.
不要 1.0.0, 用 0.0.1
v := s.Annotations.Get(OpenapiDocument) | ||
if len(v) > 0 { | ||
ret = s.GetName() | ||
return "service", ret |
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.
这里使用常量, 不然改动可能出问题
|
||
fieldSchema := &openapi.SchemaOrReference{ | ||
Schema: &openapi.Schema{ | ||
Type: "object", |
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.
我觉得这种类似的 string, 都换成 const 比较好
其他的 repo 我没有看,可能也有类似的小问题。你先解决一个后续统一一下吧 |
cc @EZ4Jam1n |
@@ -50,15 +50,16 @@ func Run() int { | |||
} | |||
|
|||
func handleRequest(req *plugin.Request) (err error) { | |||
if req == nil { | |||
fmt.Fprintf(os.Stderr, "unexpected nil request") |
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.
这里为啥不直接 return error
What type of PR is this?
feat
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional):
thrift-gen-rpc-swagger 插件
(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: