You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LYD_PARSE_ANYDATA_STRICT does not enforce mandatory leafs inside anydata #2548
yanglint -A (LYD_PARSE_ANYDATA_STRICT): data missing a mandatory
leaf inside anydata validates successfully, while the identical data
fails correctly when it's not wrapped in anydata.
An invalid value for that same leaf is still correctly rejected inside anydata
too.
yanglint version: 6.1.5
Repro example
bug.yang
module bug {
yang-version1.1;
namespace"urn:bug";
prefix b;
import ietf-yang-types { prefix yang; }
list item {
key"name";
leaf name { typestring; }
leafvalue { type yang:date-and-time; mandatorytrue; }
}
container top {
anydata payload;
}
}
1) value present but malformed, inside anydata → correctly fails
$ cat data-invalid-value.json
{
"bug:top": {
"payload": {
"bug:item": [ { "name": "x", "value": "not-a-date" } ]
}
}
}
$ yanglint -A -e -p . bug.yang data-invalid-value.json -f json
libyang err : Unsatisfied pattern - "not-a-date" does not match "...". (/bug:top/payload/item[name='x']/value)
YANGLINT[E]: Failed to parse input data file "data-invalid-value.json".
$ echo $?
1
2) value (mandatory) missing entirely, inside anydata → BUG: passes
Should the data be fully validated? Strict parsing does not mean validation so the current functionality is not incorrect. Until a proper specification of anydata validation is out, I am not sure it makes sense to make any changes.
Activity
michalvasko commentedon Aug 7, 2026
Should the data be fully validated? Strict parsing does not mean validation so the current functionality is not incorrect. Until a proper specification of anydata validation is out, I am not sure it makes sense to make any changes.
rodonile commentedon Sep 8, 2026
@michalvasko this is also happening for sx:structure
Json without mandatory value leaf.
{ "bug-structure:top": { "item": [ { "name": "x" } ] } }Let me know if I should open another issue.
Cheers,
Leonardo
validation BUGFIX proper ext data validation
michalvasko commentedon Sep 15, 2026
Right, that was caused by a bug, fixed.