go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/common/proto/protowalk/fields_test.proto (about)

     1  // Copyright 2022 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package protowalk;
    18  
    19  import "google/api/field_behavior.proto";
    20  import "google/protobuf/descriptor.proto";
    21  import "google/protobuf/struct.proto";
    22  
    23  option go_package = "go.chromium.org/luci/common/proto/protowalk";
    24  
    25  message CustomExt {
    26    string must_equal = 1;
    27  }
    28  
    29  extend google.protobuf.FieldOptions {
    30    CustomExt custom = 50002;
    31  }
    32  
    33  message Inner {
    34    message Embedded {
    35      string regular = 1;
    36  
    37      string deprecated = 2 [deprecated = true];
    38      string output = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
    39      string req = 4 [(google.api.field_behavior) = REQUIRED];
    40      string custom = 5 [(protowalk.custom).must_equal = "hello"];
    41    }
    42  
    43    message Recursive {
    44      int64 output_only = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
    45      int64 regular = 2;
    46      Recursive next = 3;
    47    }
    48  
    49    string regular = 1;
    50  
    51    string deprecated = 2 [deprecated = true];
    52    string output = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
    53    string req = 4 [(google.api.field_behavior) = REQUIRED];
    54    string custom = 5 [(protowalk.custom).must_equal = "hello"];
    55  
    56    Embedded single_embed = 6;
    57    repeated Embedded multi_embed = 7;
    58    map<string,Embedded> map_embed = 8;
    59    google.protobuf.Struct struct = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
    60    Recursive recursive = 10 [deprecated = true];
    61  }
    62  
    63  message A {
    64    string a_value = 1;
    65    B b = 2;
    66    Chh c = 3;
    67  }
    68  
    69  message B {
    70    string b_value = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
    71    A a = 2;
    72  }
    73  
    74  message Chh {
    75    map<string,A> a_map = 1;
    76  }
    77  
    78  message Outer {
    79    string regular = 1;
    80  
    81    string deprecated = 2 [deprecated = true];
    82    string output = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
    83    string req = 4 [(google.api.field_behavior) = REQUIRED];
    84    string custom = 5 [(protowalk.custom).must_equal = "hello"];
    85  
    86    Inner single_inner = 6;
    87    repeated Inner multi_inner = 7;
    88    map<string,Inner> map_inner = 8;
    89  
    90    repeated Inner multi_deprecated = 9 [deprecated = true];
    91  
    92    map<int32,Inner> int_map_inner = 10;
    93  
    94    Inner output_inner = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
    95  
    96    google.protobuf.Struct struct = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
    97  
    98    A a = 13;
    99    B b = 14;
   100  }