mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
(goctl)feature: supported sse generation (#5082)
Co-authored-by: Kevin Wan <wanjunfeng@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -244,6 +244,7 @@ func (a *Analyzer) fillService() error {
|
||||
group.Annotation.Properties = a.convertKV(item.AtServerStmt.Values)
|
||||
}
|
||||
|
||||
sse := group.GetAnnotation("sse") == "true"
|
||||
for _, astRoute := range item.Routes {
|
||||
head, leading := astRoute.CommentGroup()
|
||||
route := spec.Route{
|
||||
@@ -277,6 +278,13 @@ func (a *Analyzer) fillService() error {
|
||||
}
|
||||
route.ResponseType = responseType
|
||||
}
|
||||
if route.ResponseType == nil && sse {
|
||||
if route.RequestType != nil {
|
||||
return ast.SyntaxError(astRoute.Route.Request.Pos(), "missing response type")
|
||||
} else {
|
||||
return ast.SyntaxError(astRoute.Route.Path.Pos(), "missing response type")
|
||||
}
|
||||
}
|
||||
|
||||
if err := a.fillRouteType(&route); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user