Skip to content

bug in protoc-gen-swagger with put method and field_mask #1271

Closed
@vtolstov

Description

@vtolstov

protoc-gen-swagger from current grpc-gateway master

  rpc Update(AccountUpdateReq) returns (Account) {                                                              
    option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { operation_id: "AccountUpdate";     
   responses: {                                                                                                 
     key: "default";                                                                                            
     value: {                                                                                                   
       description: "Error response";                                                                           
       schema: {                                                                                                
         json_schema: {                                                                                         
           ref: ".Error";                                                                              
         }                                                                                                      
       }                                                                                                        
     }                                                                                                          
   }                                                                                                            
                                                                                                                
};                                                                                                              
    option (google.api.http) = { put: "/api/v0/accounts/{account.uuid}" body: "account"; };            
  };                                                                                                            

message AccountUpdateReq {                           
  Account account = 1;                               
  google.protobuf.FieldMask fields = 2;              
};                                                   

generates:

   "/api/v0/accounts/{account.uuid}": {
     "put": {
       "operationId": "AccountUpdate",
       "responses": {
         "200": {
           "description": "A successful response.",
           "schema": {
             "$ref": "#/definitions/Account"
           }
         },
         "default": {
           "description": "Error response",
           "schema": {
             "$ref": "#/definitions/Error"
           }
         }
       },
       "parameters": [
          {
            "name": "account.uuid",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Account"
            }
          }
        ],
        "tags": [
          "AccountService"
        ]
      }
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions