Dogacel / kotlinx-protobuf-gen

Generate kotlinx serializable data classes from protobuf
Apache License 2.0
12 stars 3 forks source link

[BUG] Message without any properties is not compilable #20

Closed Dogacel closed 1 year ago

Dogacel commented 1 year ago

Describe the bug A proto message without any properties creates a code that is not compilable.

To Reproduce

syntax = "proto3";

message Hello {
  enum Type {
    UNKNOWN = 0;
    KNOWN = 1;
  }
  message SubHello {
    message HelloExtend {
      optional Type type = 1;
    }
    optional SubHello subHello = 1;
  }
}

Expected behavior A data class shouldn't be generated, instead it should be just class.

Additional context Data classes require at least 1 property.

Dogacel commented 1 year ago

@tamnguyenhuy I have found some bugs in the solution, added some tests and released as the snapshot. You might need to prune your snapshot cache to get the latest version. Please let me know if anything looks odd.

I felt urgency from your messages regarding the fix so wanted to complete it considering we live in different timezones and it is usually hard to find a common time to work. Let me know if you have any questions 🙂