Browse Source

fix(generator):修复服务标签生成逻辑

- 使用 API 标题替代服务名称作为默认主机参数
-采用 API 标题和描述替换服务注释生成标签
- 移除对服务注释字符串的过滤处理
lihf 1 day ago
parent
commit
74887d49f2
1 changed files with 2 additions and 3 deletions
  1. 2 3
      generator/generator.go

+ 2 - 3
generator/generator.go

@@ -903,7 +903,7 @@ func (g *OpenAPIv3Generator) addPathsToDocumentV3(d *v3.Document, services []*pr
 			defaultHost := proto.GetExtension(service.Desc.Options(), annotations.E_DefaultHost).(string)
 
 			op, path2 := g.buildOperationV3(
-				d, operationID, service.GoName, comment, defaultHost, path, bodyField, inputMessage, outputMessage)
+				d, operationID, d.Info.Title, comment, defaultHost, path, bodyField, inputMessage, outputMessage)
 
 			// Merge any `Operation` annotations with the current
 			proto.Merge(op, extOperation.(*v3.Operation))
@@ -912,8 +912,7 @@ func (g *OpenAPIv3Generator) addPathsToDocumentV3(d *v3.Document, services []*pr
 		}
 
 		if annotationsCount > 0 {
-			comment := g.filterCommentString(service.Comments.Leading)
-			d.Tags = append(d.Tags, &v3.Tag{Name: service.GoName, Description: comment})
+			d.Tags = append(d.Tags, &v3.Tag{Name: d.Info.Title, Description: d.Info.Description})
 		}
 	}
 }