Skip to content

In Protobuf messages the "option csharp_namespace ..." attribute is ignored #229

@jplumhoff

Description

@jplumhoff

In our protobuf messages, we specify both the package and the csharp namespace. For example:

syntax = "proto3";

package iss.protobuf.digital_production;

import "google/protobuf/wrappers.proto";

option csharp_namespace = "Iss.Protobuf.DigitalProduction";

message DocumentDataSetInsertReply {
  enum Statuses {
    DOCUMENTDATAINSERT_STATUS_UNSPECIFIED = 0;
    DOCUMENTDATAINSERT_STATUS_COMPLETE = 1;
    DOCUMENTDATAINSERT_STATUS_FAILED = 2;
  }
  Statuses status = 1;
  google.protobuf.StringValue message = 2;
}

These messages do not deserialize correctly. The ConfluentProtobufTypeNameResolver returns "iss.protobuf.digital_production.DocumentDataInsertReply" instead of the expected "Iss.Protobuf.DigitalProduction.DocumentDataInsertReply".

I had hoped that I could pull the csharp_namespace from the FileDescriptorProto returned by the message parser. But when autoregistering the schema with the registry, it looks like the csharp_namespace attribute is filtered out of the stored schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions