-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Swagger Gen: underscores -> lowerCamelCase field names and refs #261
Comments
This is a little tricky since the marshaler can be customized -- IMO defaulting to the default marshaler |
I would also be supportive of switching over to &JSPNpb{OrigName: true} as the default. This is another breaking change. Maybe we should wrap this up along with the context change and do a 2.0 release? |
Just to be clear the current behavior is expected. Respecting the field names in the proto file vs the canonical json representation of proto3 (lowerCamelCase) was introduced in PR #151 (adding This probably merits a documentation addition. If we want to discuss changing the default marshaler configuration (and the swagger output) we can in another issue. |
opened #266 |
@tmc How do you customize the marshaler, specifically the |
@yingzong unfortunately there is not a mechanism to provide these options. You can open a feature request to allow providing an option of this sort. |
Protobuf3 style guidelines suggest using underscores in Message field names in .proto files, and the JSON mappings will be translated to use lowerCamelCase field names (https://developers.google.com/protocol-buffers/docs/proto3).
For the same reasons (ie JSON encoding derived form the Swagger), shouldn't these field names be in lowerCamelCase format in the grpc-gateway-generated Swagger as well?
I am running into this issue using swagger-codegen on Swagger produced by grpc-gateway. The work around is to use the lowerCamelCase in original protobuf files - I am not sure if this introduces problems with other protoc codegen paths.
The text was updated successfully, but these errors were encountered: