Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI not generating correct examples for gRPC #2584

Open
nitinmohan87 opened this issue Jun 11, 2020 · 1 comment
Open

CLI not generating correct examples for gRPC #2584

nitinmohan87 opened this issue Jun 11, 2020 · 1 comment
Labels

Comments

@nitinmohan87
Copy link
Contributor

If an attribute has nested type (e.g. MapOf(String, ArrayOf(String)) CLI should print out the correct examples to pass in the params

CLI should also print any unmarshal errors for easier debugging

@smessier
Copy link
Contributor

there also seems to be a problem for CLI parsing MapOf(String, ArrayOf(String)) passed in a message argument. for example:

my_service-cli --url "localhost:8080" my action --message '{"headers": {"Foo": ["bar"]}}'
invalid JSON for message, example of valid JSON:
'{
  "headers": {
	 "key": [
		"value"
	 ]
  },
}'
run 'my_service-cli --help' for detailed usage.

stepping through the cli code in the debugger, the JSON parser is trying to unmarshal headers as map[string]*ArrayOfString where ArrayOfString is defined in the my.pb.go file as:

type ArrayOfString struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Field []string `protobuf:"bytes,1,rep,name=field,proto3" json:"field,omitempty"`
}

this is odd because it seems protobuf should not be involved in the initial unmarshaling of the JSON message passed to CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants