Skip to content

Commit

Permalink
feat: remove permissionCode
Browse files Browse the repository at this point in the history
  • Loading branch information
fynntang committed Sep 4, 2023
1 parent 00ce05a commit eb4546c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
8 changes: 2 additions & 6 deletions protoc-gen-go-http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,9 @@ func genService(_ *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFi
rule, ok := proto.GetExtension(method.Desc.Options(), annotations.E_Http).(*annotations.HttpRule)
if rule != nil && ok {
for _, bind := range rule.AdditionalBindings {
md := buildHTTPRule(g, method, bind)
sd.Methods = append(sd.Methods, md)
sd.PermissionCodes = append(sd.PermissionCodes, md.PermissionCodes...)
sd.Methods = append(sd.Methods, buildHTTPRule(g, method, bind))
}
md := buildHTTPRule(g, method, rule)
sd.Methods = append(sd.Methods, md)
sd.PermissionCodes = append(sd.PermissionCodes, md.PermissionCodes...)
sd.Methods = append(sd.Methods, buildHTTPRule(g, method, rule))
} else if !omitempty {
path := fmt.Sprintf("/%s/%s", service.Desc.FullName(), method.Desc.Name())
sd.Methods = append(sd.Methods, buildMethodDesc(g, method, http.MethodPost, path))
Expand Down
5 changes: 0 additions & 5 deletions protoc-gen-go-http/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ var httpTemplate = `
{{$svrType := .ServiceType}}
{{$svrName := .ServiceName}}
{{- range .PermissionCodes}}
const PermissionCode{{.Name}} = "{{.Code}}"
{{- end}}
//
{{- range .MethodSets}}
const Route{{$svrType}}{{.OriginalName}} = "{{.Path}}" {{- if ne .OriginalComment ""}} {{.OriginalComment}} {{.Method}}{{- end}}
{{- end}}
Expand Down

0 comments on commit eb4546c

Please sign in to comment.