Okay thanks, but then what is the recommended way of "defending" bad requests.
If I have a message that is: *message ValidateStreetRequest {* * string street = 1;* *};* I can pass this to my function above because the *street* field is aligned with the *GetAddressInfoRequest* but there is no validation from the rpc call that it was called with the correct message. As both messages have *required* fields I could check the size of the message against what's expected, but that doesn't help me when fields are *optional.* Any suggestions? Thanks. Brad On Wed, 3 May 2023 at 10:57, Eric Anderson <ej...@google.com> wrote: > No, there is no validation. The type arguments are implicit given the > method, and there's no communication that would tell you that there is a > mis-match. The only time you'd need such a thing is if you change the > request/response message in the proto, so "don't do that." Instead, create > a new function with the new signature that you want. > > On Mon, May 1, 2023 at 7:30 AM Brad Post <b...@passportfintech.com> wrote: > >> Is there a built in validator to ensure that the message passed to a >> method is the correct one? >> >> For example: >> >> *message GetAddressInfoRequest {* >> * string street = 1;* >> * string zip = 2;* >> *};* >> >> >> *rpc get_address_info(GetAddressInfoRequest) returns (GetAddressResult);* >> >> I would like the function (get_address_info) to throw an exception/error >> if the signature for the incoming message doesn't match the >> *GetAddressInfoRequest* signature. >> >> Thanks. >> >> Brad >> >> -- >> You received this message because you are subscribed to the Google Groups >> "grpc.io" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to grpc-io+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/grpc-io/92d1edcd-6ef4-4a98-a415-34d2256a72d1n%40googlegroups.com >> <https://groups.google.com/d/msgid/grpc-io/92d1edcd-6ef4-4a98-a415-34d2256a72d1n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAJEn%3DBssZ8_LHcEhxberEbAq%2BH1_0hovd3sDQM9PF32VwZPinQ%40mail.gmail.com.