mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
528 stars 342 forks source link

leaf-list - Min-Elements issue #895

Closed kannanwst closed 3 months ago

kannanwst commented 3 months ago

Reported Issue: RNG file does NOT contain min-elements tag when the value is 1. RNG file contains min-elements tag when the value is > 1.

Step1 - mod1.yang

module mod1 { namespace "urn:mod1"; prefix m1;

leaf-list le1 { type string; min-elements 1; max-elements 4; } }

Step2 - run the command

pyang -f dsdl --dsdl-no-documentation --dsdl-lax-yang-version mod1.yang -o mod1.rng

Step3 - mod1.rng output

" <?xml version="1.0" encoding="UTF-8"?>2024-03-19</dc:date>YANG module 'mod1'</dc:source></nma:data>YANG module 'mod1'</dc:source></nma:data> "

Step 4 - Issue

min-elements ="1" Not available for .rng file.

mbj4668 commented 3 months ago

This is by design. Please see section 10.28 in RFC 6110.

kannanwst commented 3 months ago

Thanks for quick response