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

Swagger Codegen With Multiple Additional Bindings is resulting in missing Documentation #1149

Closed
bandikishores opened this issue Mar 4, 2020 · 1 comment

Comments

@bandikishores
Copy link

bandikishores commented Mar 4, 2020

In a proto if we define a service with 2 rpc's, both having an additional_bindings then only the last additional_bindings is being honored while generating swagger documentation. The other rpc's additional bindings are totally missing.

service UserService {
  rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse){
      option (google.api.http) = {
          delete: "/organizations/{orgName}/users/{name}"
          additional_bindings {
              get: "/users/{name}"
          }
      };
  }

  rpc StreamUsers(GetUserRequest) returns (stream GetUserResponse){
      option (google.api.http) = {
          get: "/organizations/{orgName}/streamusers/{name}"
          additional_bindings {
              get: "/users/{name}"
          }
      };
  }
}

The corresponding Swagger generated contains only one Alternative Binding (StreamUser2 is present, binding for DeleteUser2 is missing).

{
    "swagger": "2.0",
    ...,
    "paths": {
      "/organizations/{orgName}/streamusers/{name}": {
        "get": {
          "operationId": "StreamUsers",
          "responses": {
            "200": {
              "description": "A successful response.(streaming responses)",
              "schema": {
            ...,
        "delete": {
          "operationId": "DeleteUser",
          "responses": {
            "200": {
              "description": "A successful response.",
              "schema": {
            ...,
      "/users/{name}": {
        "get": {
          "operationId": "StreamUsers2",
          "responses": {
            "200": {
              "description": "A successful response.(streaming responses)",
              "schema": {
  }

Sample Proto File is available here
Sample Swagger Json is available here

@bandikishores
Copy link
Author

This issue was because both the bindings had the same option & path. Closing the issue.

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

No branches or pull requests

1 participant