Must statement issue on leaves with default values

I want to configure either ‘one’ or ‘two’; the following must statements
are not working. If i remove the default values, then they are working
as intended. how do I get around this limitation?

leaf one {
type uint32;
default 100;
must “not(…/two)” {
error-message “one and two cannot be configured”
}
}
leaf two {
type uint32;
default 200;
must “not(…/one)” {
error-message “one and two cannot be configured”
}

The default statement implies existence of the leaf, assuming it’s parent node “exists”. This contradicts with “one or the other” that your must statements try to enforce…

For this scenario, maybe the choice statement can address this without need of musts?

https://tools.ietf.org/html/rfc7950#section-7.9

edit: so, something like:

choice one-or-two-leaf { 
  case one {
    leaf one {
      type uint32;
      default 100;
    }
  case two {
    leaf two {
      type uint32;
      default 200;
    }
  }
}

Or if you want both leafs in the config you can do something like this:

leaf one {
    type uint32;
    default 100;
    must ". = 100 or ../two = 200" {
      error-message "one and two cannot be configured";
    }
  }
  leaf two {
    type uint32;
    default 200;
  }
}