This commit is contained in:
k.a 2022-08-04 12:17:59 -07:00
Родитель 2923964d2f
Коммит 65fd105923
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -57,4 +57,10 @@ examples: $(BQ_PLUGIN)
run:
go build -o ~/bin/protoc-gen-bq-schema cmd/main.go
protoc -I ~/commerce/commerce-apis/ -I ~/commerce/commerce-apis/third_party/ --bq-schema_out=.scratch --bq-schema_opt=single-message --bq-schema_opt=Mcommerce/subscription.renewed.proto=subscription commerce/subscription.renewed.proto
protoc \
-I ~/commerce/commerce-apis/ \
-I ~/commerce/commerce-apis/third_party/ \
--bq-schema_out=.scratch \
--bq-schema_opt=single-message \
--bq-schema_opt=Mcommerce/order.created.proto=subscription \
~/commerce/commerce-apis/commerce/order.created.proto

Просмотреть файл

@ -111,6 +111,10 @@ func traverseMessage(pkgName string, msg *descriptor.DescriptorProto, path strin
var bqField *BQField
schema := make(BQSchema, 0)
fields := msg.GetField()
if parentMessages[msg] {
glog.Errorf("Detected recursion for message %s, ignoring subfields", *msg.Name)
return nil
}
parentMessages[msg] = true
for idx, fieldProto := range fields {
fieldCommentPath := fmt.Sprintf("%s.%d.%d", path, fieldPath, idx)