-
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
Documentation: 'base_path' Swagger attribute confuses users #918
Comments
I see why this is confusing, but the swagger annotations in general change nothing about how the go files are generated. The base path is for configuring your swagger annotations when you're not serving the grpc-gateway on /, so those paths would otherwise be incorrect. I think the gateway is behaving correctly here, but we could clearly do with adding some better documentation. Would you be interested in contributing some documentation updates for the |
I'm am trying to understand in what use case using 'base_path' would yield correct behavior. AFAIK, every swagger tool is going to prepend 'base_path' to all API paths, so if path in 'google.api.http' is absolute, but swagger assumes when basePath is present generated paths are relative - this seems like it would always result incorrect code from the Swagger that breaks. In short, I don't see any way to generate correct swagger when using 'base_path' - maybe i'm just missing it. It seems like the valid 'fixes' here would be:
|
Thinking more on this, perhaps you are suggesting # 4 is how we should work with base_path in general? I suspect this would work just fine for me, but yes, that is confusing. Not against updating the docs to indicate that, but since I never found docs on base_path, wouldn't know where to update. |
I think the following is true:
I think the best place to add some documentation about the base path is in the proto definition:
How does that sound? |
Works for me - thanks for taking the time to explain |
* Add base_path docs to explain behavior * Add to 'base_path' description * Regenerated Go code from protobuf * Revert go.mod to previous version Closes #918
* Add base_path docs to explain behavior * Add to 'base_path' description * Regenerated Go code from protobuf * Revert go.mod to previous version Closes grpc-ecosystem#918
Steps you follow to reproduce the error:
What did you expect to happen instead:
I expected the API to remain working
What's your theory on why it isn't working:
The generated code was previously generating this:
It is now generating this:
It seems like the generator is not aware of the 'base_path' attribute and expects the 'google.api.http' to hold the entire path. However, adding this path back on (while retaining 'base_path' attribute) has the impact of:
The text was updated successfully, but these errors were encountered: