module github.com/mfridman/protoc-gen-go-json go 1.23.2 require ( github.com/bufbuild/protoplugin v0.0.0-20240911180120-7bb73e41a54a github.com/mfridman/buildversion v0.3.0 github.com/stretchr/testify v1.9.0 google.golang.org/protobuf v1.35.1 ) require ( github.com/davecgh/go-spew v1....
当使用protocgen- go从proto文件生成go代码时,json的密钥名称将保留为proto文件中指定的密钥。在官方字段中,推荐使用snake case。当我检查protocgen-go的生成器代码时,我确实设置了字段名称。jsonName := *field.Name tag := fmt.Sprintf("protobuf:%s json:%q", g.goTag(message, field, wiretype), ...
It is very useful to ignore XXX* fields in protobuf generated messages. The go protocol buffer compiler addsjson:"-"tag to all XXX* fields. Additional tags can be added to these fields using the 'xxx' option of PGGT. It can be done like this. All '+' characters will be replaced wi...
"uid"`// @tag: uri: uname; xml;json:test,ttagNamestring`protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty,test,ttag" uri:"uname" xml:"name"`// @tag: binding:gt=0,lt=200Ageint64`protobuf:"varint,3,opt,name=age,proto3" json:"age,omitempty" binding:"gt=0,lt=200...
= nil { continue } if v == nil { jsonTag, _ := tags.Get("json") jsonName := jsonTag.Name _ = tags.Set(&structtag.Tag{ Key: t, Name: jsonName, }) } } else { v := strings.SplitN(t, ":", 2) if len(v) <= 1 { continue } key := strings.TrimSpace(v[0]) ...
update protos to 3.4.1 tag of google/protobuf repo (golang#428) Sep 19, 2017 testdata Fix protoc-gen-go tests (golang#371) Jun 14, 2017 Makefile Fix protoc-gen-go/Makefile to work under go1. Jul 6, 2015 doc.go Update URLs and paths to new location of the C++ protobuf code....
--openapiv2_opt json_names_for_fields=false \ --go_out ./example --go_opt=paths=source_relative \ --go-gin_out ./example --go-gin_opt=paths=source_relative \ example/testproto/*.proto protoc-go-inject-tag -input=./example/testproto/test.pb.go --go_out ./example/api --go_op...
--openapiv2_opt json_names_for_fields=false \ --go_out ./example --go_opt=paths=source_relative \ --go-gin_out ./example --go-gin_opt=paths=source_relative \ example/testproto/*.proto protoc-go-inject-tag -input=./example/testproto/test.pb.go --go_out ./example/api --go_op...
--openapiv2_opt json_names_for_fields=false \ --go_out ./example --go_opt=paths=source_relative \ --go-gin_out ./example --go-gin_opt=paths=source_relative \ example/testproto/*.proto example/testproto/*.proto protoc-go-inject-tag -input=./example/testproto/test.pb.go 1 cha...
Is it possible to define a message with custom tags? For example defining a json name that isn't just the lowercase field name or adding a bson tag.