Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
5830
-
Normal
Description
Given the following schema:
container task-container {
list task {
key "task-id";
leaf task-id
{ type string; } container task-data {
presence "Task data";
leaf mandatory-data
leaf other-data
{ type string; } }
}
}
If one PUTs:
task:
{ task-id: "123" }it succeeds as expected without specifying the mandatory descendant leaf "mandatory-data" because its immediate ancestor, "task-data", is a presence container and it wasn't specified. This conforms to https://tools.ietf.org/html/rfc6020#section-7.6.5 (the 3rd constraint bullet below):
If "mandatory" is "true", the behavior of the constraint depends on
the type of the leaf's closest ancestor node in the schema tree that
is not a non-presence container (see Section 7.5.1):
o If no such ancestor exists in the schema tree, the leaf MUST
exist.
o Otherwise, if this ancestor is a case node, the leaf MUST exist if
any node from the case exists in the data tree.
o Otherwise, the leaf MUST exist if the ancestor node exists in the
data tree.
Therefore "mandatory-data" doesn't need to exist b/c "task-data" doesn't exist.
If one PUTs:
task: {
task-id: "123",
task-data:
}
it also succeeds. However, in this case, "task-data" is present so this seems to violate the 3rd constraint above, i.e. it should've failed b/c "mandatory-data" was not specified.