on plugin 0.1.10 having ```"request", StringValue....
# protobufs
j
on plugin 0.1.10 having
Copy code
"request", StringValue.of("aaa"),
"response", Map.of("id", "bbb")
Maybe I am not calling it correct but
Copy code
interaction.getRequest().getContents().getValue()
is empty (with
Map.of("email", "aaa")
it works fine)
Copy code
Map.of("email", StringValue.of("<mailto:a@a.com|a@a.com>"))
also returns the MISSING body
u
Ok, will have a look and see if I can replicate the issue
How do you define a service that just has a string as the message? I get an error from protoc that it requires a message type.
j
Copy code
syntax = "proto3";

import "google/protobuf/wrappers.proto";

package area_calculator;

option php_generic_services = true;
option go_package = "io.pact/area_calculator";

service Calculator {
  rpc getUserByEmail(UserEmail) returns (User) {}
  rpc getUserByEmailGoogle(google.protobuf.StringValue) returns (User) {}
  rpc getUserByEmailGoogleMessage(UserEmailGoogle) returns (User) {}
}

message UserEmailGoogle {
  google.protobuf.StringValue email = 1;
}

message UserEmail {
  string email = 1;
}

message User {
  string id = 1;
}
at which point do you get error with such proto file?
u
Uh! You're using a
google.protobuf.StringValue
, ok I'll give that a go
j
ah right its not visible from the first example as its imported
StringValue.of
is from
google.protobuf
I am also planning to ask my devs why do they use it instead of
string
today 🤔
u
string
won't work (that is what I tried), it has to be a message type and that is a primitive
👍 1
j
you probably already know, but just in case, this is how the
StringValue
looks like
Copy code
message StringValue {
  // The string value.
  string value = 1;
}
u
I've updated the plugin (version 0.1.11) which supports StringValue now. You can use a normal string in the setup for it. I.e.
Copy code
"request", "aaa",
"response", Map.of("id", "bbb")