Post protobuf schema in Schema Registry

Hi there!

I have an error when trying to register a protobuf schema in the Schema Registry using the API:

{
    "error_code": 42201,
    "message": "Invalid schema {subject=test,version=0,id=-1,schemaType=PROTOBUF,references=[ ],schema=syntax = 'proto3';package Test;import 'google/protobuf/timestamp.proto';message EventProto {int64 Id = 1;int32 CustomerId = 2;int32 ContractId = 3;google.protobuf.Timestamp StartDate = 4;google.protobuf.Timestamp EndDate = 5;}}"
}

I invoke the Post subjects/Test/versions with the following json:

{
    "schema": "syntax = 'proto3';package Test;import 'google/protobuf/timestamp.proto';message EventProto {int64 Id = 1;int32 CustomerId = 2;int32 ContractId = 3;google.protobuf.Timestamp StartDate = 4;google.protobuf.Timestamp EndDate = 5;}",
    "schemaType": "PROTOBUF"
}

Below is the proto file:

syntax = 'proto3';

package Test;
import 'google/protobuf/timestamp.proto';

message EventProto {
	int64 Id = 1;
	int32 CustomerId = 2;
	int32 ContractId = 3;
	google.protobuf.Timestamp StartDate = 4;
	google.protobuf.Timestamp EndDate = 5;
}

If I remove the google.protobuf.Timestamp fields I can register the schema.

Could you kindly help me?

Thanks a lot

@i-arge Checkout this article which describes Schema References. You’ll need to register the Timestamp schema separately and then refer to the Timestamp schema with a schema reference when registering the EventProto schema. As an FYI in Confluent Platform 6.2 this will not be required as Schema Registry will be aware of that google timestamp type natively.

https://docs.confluent.io/platform/current/schema-registry/serdes-develop/serdes-protobuf.html#referenced-schemas-protobuf

Hi Rick thanks for your reply!

I currently have to register the timestamp proto schema and then reference it from the EventProto.

It would be handy to have the native reference.
Do you know when the 6.2 release will be out?

Thanks a lot

@i-arge I don’t think I’m allowed to give out release dates. I think it’s safe for me to say Q2 is target.

Is this indeed working now? I could easily try myself, but I’m unsure as it seems timestamp isn’t ‘really’ a common type, as in, it doesn’t use com.google.type as package name.