fix http client generation without openapiv2 annotation

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-03-19 12:59:53 +03:00
parent 4d2af78ba7
commit bce3839877

18
util.go
View File

@ -55,15 +55,15 @@ func generateServiceClientMethods(gfile *protogen.GeneratedFile, service *protog
gfile.P("opts = append(opts,") gfile.P("opts = append(opts,")
gfile.P(microClientHttpPackage.Ident("ErrorMap"), "(errmap),") gfile.P(microClientHttpPackage.Ident("ErrorMap"), "(errmap),")
gfile.P(")")
if proto.HasExtension(method.Desc.Options(), api_options.E_Http) { }
endpoints, _ := generateEndpoints(method) if proto.HasExtension(method.Desc.Options(), api_options.E_Http) {
path, method, body := getEndpoint(endpoints[0]) gfile.P("opts = append(opts,")
gfile.P(microClientHttpPackage.Ident("Method"), `("`, method, `"),`) endpoints, _ := generateEndpoints(method)
gfile.P(microClientHttpPackage.Ident("Path"), `("`, path, `"),`) path, method, body := getEndpoint(endpoints[0])
gfile.P(microClientHttpPackage.Ident("Body"), `("`, body, `"),`) gfile.P(microClientHttpPackage.Ident("Method"), `("`, method, `"),`)
} gfile.P(microClientHttpPackage.Ident("Path"), `("`, path, `"),`)
gfile.P(microClientHttpPackage.Ident("Body"), `("`, body, `"),`)
gfile.P(")") gfile.P(")")
} }
} }