carvalhorr / protoc-gen-mock

47 stars 11 forks source link

Using enum value in stub prevents the http server to persist the stub #50

Open nikolahr0707 opened 3 years ago

nikolahr0707 commented 3 years ago

Since enum is encoded as string in json, the element will be a string. Direct conversion between EnumValueDescriptor and String is not sufficient,so this requires extracting the enum value descriptor's Name() and unboxing the custom name type back to string.

https://github.com/carvalhorr/protoc-gen-mock/blob/master/stub/validation.go#L93

                    if string(value.Name()) == element {