Why does the Protobuf JavaScript compiler suffix collections with "List", "Map", etc?
Asked Answered
M

0

6

Why does the protobuf JavaScript code generator suffix collections with the collection type?

For example:

  • repeated string names becomes obj.namesList
  • map<string, string> bar becomes obj.barMap

And this is as per the documentation, here: https://developers.google.com/protocol-buffers/docs/reference/javascript-generated#repeated

Why is that?

It makes life difficult when using grpc-gateway with --swagger_out because the swagger API definitions don't match the generated JavaScript.

Martelle answered 24/7, 2018 at 22:45 Comment(2)
Did you find any method to instruct compiler to suppress adding suffix?Fink
There's a feature request to enable/disable this feature - github.com/protocolbuffers/protobuf/issues/6773Walkerwalkietalkie

© 2022 - 2025 — McMap. All rights reserved.