Open baganokodo2022 opened 1 year ago
Today, I successfully reproduce the same error in a different code path,
The problem seems to be originated from the line below,
https://github.com/golang/protobuf/blob/master/proto/text_encode.go#L373
If we replace it with,
var bra, ket byte = '{', '}'
It generated the desired schema, which is accepted by Confluent Schema Registry.
syntax = "proto3";
package org.order.common;
import "google/protobuf/descriptor.proto";
import "protoc-gen-swagger/options/openapiv2.proto";
message Order {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = {
json_schema: {
title: "SimpleMessage"
description: "A simple message."
required: ["id"]
}
};
string id = 1;
}
according to the responses from https://github.com/golang/protobuf/issues/1523, the root cause is clearly on jhump/protoreflect
.
filed the issue to jhump, https://github.com/jhump/protoreflect/issues/549
the root cause is clearly on jhump/protoreflect
@baganokodo2022, I don't agree. The output in your examples is perfectly valid Protobuf source. Message literals in custom option values are allowed to use either angle brackets or curly braces for nested messages/groups.
So I think the root cause is more likely to be whatever is processing/parsing the proto sources in Confluent's schema registry. It is likely not completely compliant/compatible with what protoc (the reference compiler) considers valid source.
thanks @jhump for the inputs.
This issue is proven fixed in https://github.com/jhump/protoreflect/releases/tag/v1.15.0-rc2
FWIW, I think there is still a bug in Confluent that needs fixing: it should not be complaining about the use of angle brackets as that is allowed in protobuf sources.
The above mentioned release of github.comjhump/protoreflect
simply works around the bug, in that its protoprint
package will no longer produce files that use the angle brackets.
Description
confluent-kafka-go version v2.0.2 We make use of protobuf.Serializer in confluent-kafka-go to register proto schemas on Confluent Schema Registry. The serializer breaks on the option,
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema)
, which should be rendered as,instead, it ended up with,
CSR returned the following error message, details: Could not parse Protobuf - Syntax error in :217:18: expected a word line 217 points to
json_schema: <
How to reproduce
Create a simple protobuf message with the above message-level option like this,
In golang,
Checklist
Please provide the following information:
LibraryVersion()
): v2.0.2ConfigMap{...}
"debug": ".."
as necessary)