Does the value matter while deleting a leaf

i have a model like below

contianer contA {
 containe contB {
      presence "true";
      leaf  option {
            type string;      

now in my confd_cli i configure
i could configure as

contA contB option blah;

but when i delete the
no contA contB option diffblah

it deletes the leaf blah . I understand string is not a key .
But is this the correct behaviour ?

How can i achieve to delete leaf only if the string matches with the input ?

Kind of odd thing to do. But your desired behaviour can perhaps be achieved using something like this:

  container contA {
    container contB {
    leaf-list option {
        max-elements 1;
        type string;      

@cohult Thanks for the reply.

“Kind of odd thing to do”

Not sure which one specifically , do you mean specifying a wrong leaf string would be odd ?

the problem with leaf-list is im not able to use the following annotation tailf:cli-delete-container-on-delete;

I would also like a behaviour to delete the parent container when leaf list is deleted.

No, I am referring to that one should need to specify the data held by a leaf that you want to delete. So what do you do if someone types “no contA contB option”, “no contA contB”, or “no contA”?