This commit is contained in:
2025-04-17 00:10:46 +08:00
parent 52bfd05b80
commit 26d183f4c9
8 changed files with 94 additions and 9 deletions

View File

@@ -35,6 +35,7 @@ func (s serviceGenerator) generateInterface(f *codegen.File) {
input := typeFromMessage(s.pkg, method.Input())
output := typeFromMessage(s.pkg, method.Output())
f.P(t(1), method.Name(), "(request: ", input.Reference(), "): Promise<", output.Reference(), ">;")
})
f.P("}")
f.P()
@@ -80,6 +81,25 @@ func (s serviceGenerator) generateClient(f *codegen.File) error {
}
func (s serviceGenerator) generateMethod(f *codegen.File, method protoreflect.MethodDescriptor) error {
loc := method.ParentFile().SourceLocations().ByDescriptor(method)
var comments string
if loc.TrailingComments != "" {
comments = comments + loc.TrailingComments
}
if loc.LeadingComments != "" {
comments = comments + loc.LeadingComments
}
AllSrvMethods = append(AllSrvMethods, SrvMethod{
PkgName: string(s.pkg.Name()),
ServiceName: string(s.service.Name()),
MethodName: string(method.Name()),
Comment: comments,
In: string(method.Input().Name()),
Out: string(method.Output().Name()),
})
outputType := typeFromMessage(s.pkg, method.Output())
r, ok := httprule.Get(method)
if !ok {