...

Text file src/github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb/non_standard_names.proto

Documentation: github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb

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

View as plain text