@@ -26,11 +26,12 @@ type Args struct {
2626
2727type Env struct {
2828 * Args
29- Ignore []string `json:"ignore"`
30- Filter []string `json:"filter"`
31- Alias Alias `json:"alias"`
32- Variables map [string ]string `json:"variables"`
33- Generics * Generics `json:"generics"`
29+ Ignore []string `json:"ignore"`
30+ Filter []string `json:"filter"`
31+ Alias Alias `json:"alias"`
32+ Variables map [string ]string `json:"variables"`
33+ Generics * Generics `json:"generics"`
34+ RepeatableOperationId bool `json:"repeatable_operation_id"`
3435}
3536
3637type Alias struct {
@@ -257,7 +258,6 @@ func (e *Executor) Run(cmd *Args) error {
257258 return cmp .Compare (a .Name , b .Name )
258259 })
259260
260- //统一累计到参数集
261261 if path .Request != nil {
262262 path .Parameters = append (path .Parameters , & tmpl.Parameter {
263263 Name : "body" ,
@@ -279,6 +279,16 @@ func (e *Executor) Run(cmd *Args) error {
279279 if path .Response != nil {
280280 path .Response = findType (path .Response )
281281 }
282+
283+ //方法名 不同Tag下 方法重名下容易生成 add_1,update_39
284+ path .Name = lo .TernaryF (e .env .RepeatableOperationId , func () string {
285+ return strings .FieldsFunc (path .Name , func (r rune ) bool {
286+ return r == '_' || r == '-'
287+ })[0 ]
288+ }, func () string {
289+ return path .Name
290+ })
291+
282292 }
283293
284294 api .Paths = paths
0 commit comments