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

Please add option to use FQN as swagger name #471

Open
idy opened this issue Oct 7, 2017 · 1 comment
Open

Please add option to use FQN as swagger name #471

idy opened this issue Oct 7, 2017 · 1 comment

Comments

@idy
Copy link

idy commented Oct 7, 2017

The default logic to map FQN to swagger name is good(https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-swagger/genswagger/template.go#L332).

We have many proto files. and they have some import with each other. Use the logic to shortten FQN is not so good in some case.

e.g.

retail.proto has message CreateOrderRequest {}
warehouse.proto also has message CreateOrderRequest {}

If warehouse.proto was imported by retail, warehouse.CreateOrderRequest will use warehouseCreateOrderRequest as swagger name in retail.swagger.json. But the swagger file generated by warehouse.proto was CreateOrderRequest. It's hard for us to merge the two swagger file into one.

I prefer keep the FQN as swagger name, any ideas ?

@achew22
Copy link
Collaborator

achew22 commented Oct 28, 2017

@idy, I think this would be a great flag addition to the swagger generator.

If you want to try this out, you should look at #280 for an example of how to add a flag guarded feature. Then you would just have to get that flag value in the mapping function, add an if to maintain the old logic in the flag=false case and put your new code plus some tests in.

If you need any help with that please comment on this but and I'll point you in the right direction

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

No branches or pull requests

3 participants