go-bridget/twirp-swagger-gen

Error on using map

xsteadfastx opened this issue · 3 comments

Using the latest version i get this error when having a map in my proto files. For example:

syntax = "proto3";

package apm.v1;

option go_package = "example.com/apm";

message ExampleMap {
	map<string, string> something = 1;
}

With this command:

twirp-swagger-gen -in example/example_map.proto -out example/simple/example.swagger.json -host test.example.com

This error:

2022/03/10 19:14:16  info Unknown field type: *proto.MapField

What's the expected swagger definition for that?

What's the expected swagger definition for that?

@titpetric I think it should be a dictionary:

type: object
additionalProperties:
  type: string

Output Example:

{
  "additionalProp1": "string",
  "additionalProp2": "string",
  "additionalProp3": "string"
}

@AmirSoleimani are you still interested in this? Would you be able to contribute a PR?