Skip to content

Commit

Permalink
generate annotations for multiple services in the same map
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Sep 30, 2024
1 parent eb898b7 commit 2029ca9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion _examples/golang-basics/example.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions _examples/golang-imports/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions types.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@

{{- end }}

{{ range $_, $service := $services -}}
var (
methodAnnotations = map[string]map[string]string{
{{- range $_, $method := $service.Methods }}
"/rpc/{{$service.Name}}/{{$method.Name}}": {
{{- range $_, $annotation := $method.Annotations -}}
"{{$annotation.AnnotationType}}": "{{$annotation.Value}}",
{{- end -}}
},
{{- end }}
{{- range $_, $service := $services -}}
{{- range $_, $method := $service.Methods }}
"/rpc/{{$service.Name}}/{{$method.Name}}": {
{{- range $_, $annotation := $method.Annotations -}}
"{{$annotation.AnnotationType}}": "{{$annotation.Value}}",
{{- end -}}
},
{{- end -}}
{{ end }}
}
)
{{ end }}


var WebRPCServices = map[string][]string{
{{- range $_, $service := $services}}
Expand Down

0 comments on commit 2029ca9

Please sign in to comment.