I have to take an input in rpc only in one previous input is taken. For Example if we input value for field a then value for field b is compulsory.
I am new to it, I tried giving mandatory true for the last value.
I have to take an input in rpc only in one previous input is taken. For Example if we input value for field a then value for field b is compulsory.
I am new to it, I tried giving mandatory true for the last value.
To have a second parameter become conditionally mandatory based on the first parameter, use
whenandmandatoryat the same time.The
when "../first";condition, which is defined forleaf secondsays something like: "in a valid rpc instance document, leaf 'second' may only appear if leaf 'first' exists". If you add themandatory truetoleaf second, this becomes: "in a valid rpc instance document, leaf 'second' must appear if leaf 'first' exists."Note that
leaf firstis optional in my example.rpc foomay only be sent without parameters or with both parameters at the same time.Why does it work that way?
RFC 7950, Section 7.14.2 describes how
inputdefinitions work:Section 8 of the same RFC describes how constraints such as
whenandmandatoryare applied - thewhencondition takes precedence: