Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool does not properly handle the types from google.protobuf.wrappers in messages #4576

Closed
madhukaw opened this issue Jun 15, 2023 · 1 comment · Fixed by ballerina-platform/protoc-tools#26
Assignees
Labels
module/protoc-tool Team/PCM Protocol connector packages related issues Type/Bug

Comments

@madhukaw
Copy link
Contributor

Description:

Tool does not correctly handle the types from google.protobuf.wrappers.

  • UInt64Value
  • Int32Value
  • BoolValue
    These are correctly handled when it is applied in the service definition. However, the tool does not pick it up correctly when they are defined in a message.

Steps to reproduce:

syntax = "proto3";

import "google/protobuf/wrappers.proto";

message Test6 {
    google.protobuf.StringValue a = 1;
    google.protobuf.Int32Value b = 2;
    google.protobuf.UInt32Value c = 3;
    google.protobuf.Int64Value d = 4;
    google.protobuf.UInt64Value e = 5;
    google.protobuf.DoubleValue f = 6;
    google.protobuf.FloatValue g = 7;
    google.protobuf.BoolValue h = 8;
    google.protobuf.BytesValue i = 9;
}

Generate the stub file using the bal grpc command.

Expected output:

import ballerina/protobuf;

const string TESTMESSAGE2_DESC = "0A12746573744D657373616765322E70726F746F1A1E676F6F676C652F70726F746F6275662F77726170706572732E70726F746F228D030A055465737436122A0A016118012001280B321C2E676F6F676C652E70726F746F6275662E537472696E6756616C756552016112290A016218022001280B321B2E676F6F676C652E70726F746F6275662E496E74333256616C7565520162122A0A016318032001280B321C2E676F6F676C652E70726F746F6275662E55496E74333256616C756552016312290A016418042001280B321B2E676F6F676C652E70726F746F6275662E496E74363456616C7565520164122A0A016518052001280B321C2E676F6F676C652E70726F746F6275662E55496E74363456616C7565520165122A0A016618062001280B321C2E676F6F676C652E70726F746F6275662E446F75626C6556616C756552016612290A016718072001280B321B2E676F6F676C652E70726F746F6275662E466C6F617456616C756552016712280A016818082001280B321A2E676F6F676C652E70726F746F6275662E426F6F6C56616C756552016812290A016918092001280B321B2E676F6F676C652E70726F746F6275662E427974657356616C7565520169620670726F746F33";

@protobuf:Descriptor {value: TESTMESSAGE2_DESC}
public type Test6 record {|
    string a = "";
    int b = 0;
    int c = 0;
    int d = 0;
    int e = 0;
    float f = 0;
    float g = 0;
    boolean h = false;
    byte[] i = [];
|};

Actual output:

import ballerina/protobuf;
import ballerina/protobuf.types.wrappers;

public const string TESTMESSAGE2_DESC = "0A12746573744D657373616765322E70726F746F1A1E676F6F676C652F70726F746F6275662F77726170706572732E70726F746F228D030A055465737436122A0A016118012001280B321C2E676F6F676C652E70726F746F6275662E537472696E6756616C756552016112290A016218022001280B321B2E676F6F676C652E70726F746F6275662E496E74333256616C7565520162122A0A016318032001280B321C2E676F6F676C652E70726F746F6275662E55496E74333256616C756552016312290A016418042001280B321B2E676F6F676C652E70726F746F6275662E496E74363456616C7565520164122A0A016518052001280B321C2E676F6F676C652E70726F746F6275662E55496E74363456616C7565520165122A0A016618062001280B321C2E676F6F676C652E70726F746F6275662E446F75626C6556616C756552016612290A016718072001280B321B2E676F6F676C652E70726F746F6275662E466C6F617456616C756552016712280A016818082001280B321A2E676F6F676C652E70726F746F6275662E426F6F6C56616C756552016812290A016918092001280B321B2E676F6F676C652E70726F746F6275662E427974657356616C7565520169620670726F746F33";

@protobuf:Descriptor {value: TESTMESSAGE2_DESC}
public type Test6 record {|
    StringValue a = {};
    Int32Value b = {};
    UInt32Value c = {};
    Int64Value d = {};
    UInt64Value e = {};
    DoubleValue f = {};
    FloatValue g = {};
    BoolValue h = {};
    BytesValue i = {};
|};

Affected Versions:
Ballerina 2201.6.0

Related Issues (optional):

#4544

@github-actions
Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/protoc-tool Team/PCM Protocol connector packages related issues Type/Bug
Projects
Archived in project
1 participant