3 import "dccl/option_extensions.proto";
22 required State state = 1;
24 optional int32 a = 2 [(dccl.field) = {
29 required_if: "return this.state == 'STATE_1'"
30 omit_if: "return this.state ~= 'STATE_1'"
34 optional int32 b = 3 [(dccl.field) = {
38 // if no return in script, assume it is implicit - DCCL will prefix
40 required_if: "this.state == 'STATE_2'"
41 omit_if: "this.state ~= 'STATE_2'"
45 optional int32 c_center = 4 [
51 // same as required_if: "this.state == 'STATE_3'" and omit_if ~=
53 only_if: "this.state == 'STATE_1'"
59 optional int32 c = 6 [(dccl.field) = {
63 only_if: "this.state == 'STATE_1'"
64 min: "this.c_center-100"
65 max: "this.c_center+100"
69 repeated int32 d = 7 [(dccl.field) = {
75 only_if: "this_index ~= 4"
77 max: "this_index*50+100"
81 repeated Child child = 10 [(dccl.field) = { max_repeat: 10 }];
92 required IncludeI include_i = 1;
93 optional int32 i = 2 [(dccl.field) = {
96 // within the embedded message, 'this' refers to the embedded
97 // message (innermost scope) ...
98 dynamic_conditions { only_if: "this.include_i == 'YES'" }
101 optional int32 i2 = 3 [(dccl.field) = {
104 // ... but the entire message is still accessible with 'root', and
105 // 'this_index' refers to the current repeated message index
107 only_if: "print(this_index); return root.child[this_index].include_i == 'YES'"
121 required IncludeI include_i = 1;
122 optional int32 i = 2 [(dccl.field) = {
125 dynamic_conditions { only_if: "this.include_i == 'YES'" }
130 required Child2 child2 = 11;
141 required IncludeI include_i = 1;
142 optional int32 i = 2 [(dccl.field) = {
145 // check that root works correctly here
146 dynamic_conditions { only_if: "root.child3.include_i == 'YES'" }
150 // since this message uses local scoping only, we can include it again
151 optional Child2 subchild = 3;
153 optional Child3 child3 = 12;