Hi Kent,
Kent Watsen <[email protected]> writes:
> How does validation work if a union has multiple leafref/instance-identifier
> types with default "require-instance true"? For instance:
>
> typedef foo {
> type leafref {
> path "/widgets/name";
> require-instance true;
> }
> }
>
> typedef bar {
> type instance-identifier {
> require-instance true;
> }
> }
>
> leaf baz {
> type union {
> type foo;
> type bar;
> }
> }
>
>
> The general validation approach is to step thru the various union types until
> first match or no match. But when there are multiple "require-instance true"
> types, will validation succeed only if all match?
Verification of the required instance existence should be part of the union
member selection: if the instance doesn't exist, the corresponding member won't
be selected. So in your example validation should suceed if an instance exists
for just one of the union members.
I suspect your question might reflect behaviour of pyang/yang2dsdl validation.
The thing is that this case cannot be properly handled by DSDL schemas
generated according to RFC 6110 because type validation for leafref and
instance-identifier is split between RELAX NG and Schematron. Schematron
validation doesn't know which union member was matched during RELAX NG
validation and so both require-instance statements are represented as two
independent Schematron asserts and both are enforced.
Lada
>
>
> _______________________________________________
> netmod mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
--
Ladislav Lhotka <[email protected]>
PGP Key ID: 0xB8F92B08A9F76C67
_______________________________________________
netmod mailing list -- [email protected]
To unsubscribe send an email to [email protected]