github.com/grpc-ecosystem/grpc-gateway/v2@v2.19.1/runtime/internal/examplepb/non_standard_names.proto (about)

     1  syntax = "proto3";
     2  
     3  package grpc.gateway.runtime.internal.examplepb;
     4  
     5  import "google/api/annotations.proto";
     6  import "google/protobuf/field_mask.proto";
     7  import "google/protobuf/struct.proto";
     8  
     9  option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb";
    10  
    11  // NonStandardMessage has oddly named fields.
    12  message NonStandardMessage {
    13    // Id represents the message identifier.
    14    string id = 1;
    15    int64 Num = 2;
    16    int64 line_num = 3;
    17    string langIdent = 4;
    18    string STATUS = 5;
    19    int64 en_GB = 6;
    20    string no = 7;
    21  
    22    message Thing {
    23      message SubThing {
    24        string sub_value = 1;
    25      }
    26      SubThing subThing = 1;
    27    }
    28    Thing thing = 8;
    29    google.protobuf.Struct struct_field = 9;
    30    google.protobuf.Value value_field = 10;
    31  }
    32  
    33  message NonStandardUpdateRequest {
    34    NonStandardMessage body = 1;
    35    google.protobuf.FieldMask update_mask = 2;
    36  }
    37  
    38  // NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion.
    39  message NonStandardMessageWithJSONNames {
    40    // Id represents the message identifier.
    41    string id = 1 [json_name = "ID"];
    42    int64 Num = 2 [json_name = "Num"];
    43    int64 line_num = 3 [json_name = "LineNum"];
    44    string langIdent = 4 [json_name = "langIdent"];
    45    string STATUS = 5 [json_name = "status"];
    46    int64 en_GB = 6 [json_name = "En_GB"];
    47    string no = 7 [json_name = "yes"];
    48  
    49    message Thing {
    50      message SubThing {
    51        string sub_value = 1 [json_name = "sub_Value"];
    52      }
    53      SubThing subThing = 1 [json_name = "SubThing"];
    54    }
    55    Thing thing = 8 [json_name = "Thingy"];
    56    google.protobuf.Struct struct_field = 9 [json_name = "StructField"];
    57    google.protobuf.Value value_field = 10 [json_name = "ValueField"];
    58  }
    59  
    60  message NonStandardWithJSONNamesUpdateRequest {
    61    NonStandardMessageWithJSONNames body = 1;
    62    google.protobuf.FieldMask update_mask = 2;
    63  }
    64  
    65  // NonStandardService responds to incoming messages, applies a field mask and returns the masked response.
    66  service NonStandardService {
    67    // Apply field mask to empty NonStandardMessage and return result.
    68    rpc Update(NonStandardUpdateRequest) returns (NonStandardMessage) {
    69      option (google.api.http) = {
    70        patch: "/v1/example/non_standard/update"
    71        body: "body"
    72      };
    73    }
    74  
    75    // Apply field mask to empty NonStandardMessageWithJSONNames and return result.
    76    rpc UpdateWithJSONNames(NonStandardWithJSONNamesUpdateRequest) returns (NonStandardMessageWithJSONNames) {
    77      option (google.api.http) = {
    78        patch: "/v1/example/non_standard/update_with_json_names"
    79        body: "body"
    80      };
    81    }
    82  }