|
|
@ -4,7 +4,6 @@ import (
|
|
|
|
"bytes"
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"path"
|
|
|
|
"path"
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"text/template"
|
|
|
|
"text/template"
|
|
|
|
|
|
|
|
|
|
|
@ -162,14 +161,13 @@ func genHandlers(dir string, api *spec.ApiSpec) error {
|
|
|
|
|
|
|
|
|
|
|
|
func genHandlerImports(group spec.Group, route spec.Route, parentPkg string) string {
|
|
|
|
func genHandlerImports(group spec.Group, route spec.Route, parentPkg string) string {
|
|
|
|
var imports []string
|
|
|
|
var imports []string
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s/rest/httpx\"", vars.ProjectOpenSourceUrl))
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s\"",
|
|
|
|
|
|
|
|
util.JoinPackages(parentPkg, getLogicFolderPath(group, route))))
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s\"", util.JoinPackages(parentPkg, contextDir)))
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s\"", util.JoinPackages(parentPkg, contextDir)))
|
|
|
|
if len(route.RequestType.Name) > 0 || len(route.ResponseType.Name) > 0 {
|
|
|
|
if len(route.RequestType.Name) > 0 || len(route.ResponseType.Name) > 0 {
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s\"", util.JoinPackages(parentPkg, typesDir)))
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s\"\n", util.JoinPackages(parentPkg, typesDir)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s\"",
|
|
|
|
imports = append(imports, fmt.Sprintf("\"%s/rest/httpx\"", vars.ProjectOpenSourceUrl))
|
|
|
|
util.JoinPackages(parentPkg, getLogicFolderPath(group, route))))
|
|
|
|
|
|
|
|
sort.Strings(imports)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return strings.Join(imports, "\n\t")
|
|
|
|
return strings.Join(imports, "\n\t")
|
|
|
|
}
|
|
|
|
}
|
|
|
|