Skip to content

Can you differentiate between an empty map vs field not provided? #552

Closed
@Ianwww

Description

With this proto definition

 message UpdateMessage {
    string id = 1;
    map[string]string my_map = 2;
 }

 service YourService {
  rpc Echo(UpdateMessage) returns (StringMessage) {
    option (google.api.http) = {
      patch: "/update"
      body: "*"
    };
  }
 }

I'd like to send a request like
{"id":"myid","my_map":{}}
and set MyMap to an empty map.

Is this possible? Currently, when this field is provided, my service thinks this field is unset(MyMap==Nil). I'm working in golang.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions