Skip to content

Support gRPC map #891

Closed
Closed
@billcchung

Description

@billcchung

Is your feature request related to a problem? Please describe it.

Current if we define proto with a map like

message UserPreferences {
  map<string, string> preference = 10;
}

the generated grpc.swift Will contain:

extension UserPreferences.PreferencesEntry: GRPCProtobufPayload {}

which resulted in an error:
Screen Shot 2020-07-14 at 21 44 41
'PreferencesEntry' is not a member type of 'UserPreferences'

in the proto3 spec map can be used.

Describe the solution you'd like

Hopefully we can have map supported.

Describe alternatives you've considered

In order to work around this we had to refactor the struct to use repeated:

message UserPreferences {
  repeated UserPreference preferences = 1;
}

message UserPreference {
  string key = 10;
  string value = 20;
}

but this isnt really ideal, hopefully we can have map supported.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugFeature doesn't work as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions