gripmock icon indicating copy to clipboard operation
gripmock copied to clipboard

add proto3 optional feature to protogen

Open NikolayOskin opened this issue 2 years ago • 2 comments

Added proto3 optional fields feature to protogen plugin

NikolayOskin avatar Jul 04 '22 09:07 NikolayOskin

Bump - would really like to see this feature get merged.

robfraz avatar Aug 30 '22 13:08 robfraz

This is great! We would love to see this change merged.

aittam avatar Aug 30 '22 13:08 aittam

@jekiapp We would love to see support for optional fields merge as well. Is this PR still valid or should I create a new one with some changes?

Jbcampbe avatar Feb 20 '23 14:02 Jbcampbe

I think bumping up of protoc image version in gripmock is proper answer for this.

sejin-P avatar Apr 18 '23 03:04 sejin-P

Hi guys sorry for a late reply, what is the motivation of this feature? I know it's just one line, but still it's not so obvious what the impact will be.

jekiapp avatar May 09 '23 06:05 jekiapp

@NikolayOskin since the tests also not updated to prove this works, I need to do test it in local first. Updating the example tests would be helpful.

jekiapp avatar May 09 '23 06:05 jekiapp

Hi @jekiapp Using https://registry.hub.docker.com/layers/tkpd/gripmock/latest/images/sha256-a8b72b039d9b66e797b87b8ff0c4668cd6202ee934037d316cde310686491c22?context=explore I still see the error:

mock-grpc-service-1  | Starting GripMock
mock-grpc-service-1  | Serving stub admin on http://:4771
mock-grpc-service-1  | data/Test.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-gripmock hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.--gripmock_out:
mock-grpc-service-1  | 2023/05/16 11:21:47 Fail on protoc exit status 1
mock-grpc-service-1 exited with code 1

My type is:

syntax = "proto3";

package data;

message Test {
  optional uint64 x = 1;
}

@jekiapp Could you take a look? @NikolayOskin is it working for you? Thank you in advance.

antonjim-te avatar May 16 '23 11:05 antonjim-te

I'm getting the same error as above about protoc-gen-gripmock using the tkpd/gripmock:v1.12.1 image. Thank you.

dezmoanded avatar Jun 07 '23 18:06 dezmoanded

Bumping this, I'm getting the same error as above. Any progress on this?

is a proto3 file that contains optional fields, but code generator protoc-gen-gripmock hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.--gripmock_out:

b0mbays avatar Jul 20 '23 11:07 b0mbays

Well, this merge fixed it for me - but it's not part of the latest release as merge happened on May 9, and 1.12.1 dates back to Feb.

To leverage this fix, I've built from github, as we don't have this in dockerhub until the next release at least. Clone & docker build works.

Example docker-compose snippet:

version: "3.9"
services:
  gripmock:
    build:
      context: https://github.com/tokopedia/gripmock.git
    ports:
    ...

Hope that helps those running into this

miklosbagi avatar Oct 11 '23 17:10 miklosbagi

Thank you @miklosbagi, that worked for me.

pablomarti avatar Jan 22 '24 14:01 pablomarti

@jekiapp could you please update the latest tag of the docker.com/r/tkpd/gripmock too?

mgerasimchuk avatar Mar 12 '24 10:03 mgerasimchuk

please re-pull the latest image, just built the v1.13 and made it latest version. https://hub.docker.com/layers/tkpd/gripmock/latest/images/sha256-e50455d0aef6d3691742e90e0c3296cee54d7e298571dac17b897d7f6e5b054c?context=repo

jekiapp avatar Mar 15 '24 08:03 jekiapp